Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: [HELP HOWTO] form for a specific record

Re: form for a specific record 27 Aug 2012 08:43 #3308

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
When you write :
$this->$user->id

We can see a syntax error. It should be :
(if $this->user is set)
$this->user->id


you can use this syntax for dynamic var names, for example
$this->a = 1;
$this->b = 2;

$varName = 'a';

echo($this->$varName);  //Returns "1"
Coding is now a piece of cake
The administrator has disabled public write access.

Re: form for a specific record 27 Aug 2012 10:45 #3313

  • BTB300
  • BTB300's Avatar
  • Online
  • Moderator
  • Posts: 414
  • Thank you received: 130
  • Karma: 46
Its the function that is called relative to layout being generated.
It provides data for a specific layout / view

function _buildQuery_default() - is the query for your tables default view
function _buildQuery() - defines the FK dropdown / combo box data (i think? from memory)

If you had two layouts for the same table

1) userdetails
2) usercontact

if your default table was userdetails...
you would have

function _buildQuery()
function _buildQuery_default()
function _buildQuery_usercontact()

if your default layout was usercontact
you would have
function _buildQuery()
function _buildQuery_userdetails()
function _buildQuery_default()

As for
function addWhere($where_clause)
it puts the item at the end of the statement
its useful if you need to define a query that returns a list of items containing specific data such as town, gender, postcode

for instance

. addWhere($address_town->id=4)
. buildQuery_WhereAuthor()

Would Give...
WHERE $user->id = 43 AND $address_town->id = 4
And the record would be returned if user #43 lived in town #4

If you understand MySql well enough and echo, copy and dump the query into your Mysql Interface it becomes a lot easier to understand whats happening
Last Edit: 27 Aug 2012 11:19 by BTB300.
The administrator has disabled public write access.

Re: form for a specific record 31 Aug 2012 08:09 #3343

  • e-struct
  • e-struct's Avatar
  • Offline
  • Senior Member
  • Posts: 76
  • Thank you received: 4
  • Karma: 5
@admin
OK what you suggest ($this->user->id) is also working... so I 've choosen this way.

I was also wondering the purpose of some methods in the models (as they have no header comments)
active() and
activeAll()

can you briefly explain.
Thks
Last Edit: 31 Aug 2012 08:10 by e-struct.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.114 seconds

Get Started