default value

Status
Not open for further replies.
Hughs' getting his code muddled

Here's what you need:

Code:
global $database, $my;
$database->setQuery("SELECT city FROM jos_comprofiler WHERE user_id = '" . $my->id . '");
return = $database->loadResult();


For Info:

loadResult() will return a string containing data from the first column selected from the first row

loadObject() will return an object representing the first row of data with key/value pairs for each field specified in the SQL query#

loadObjectList() will return an array of objects - where each object represents a row from the database table
 
Hi Rob,

Thanks for your help, unfortunately my form field is still empty ...

I have the feeling that maybe something is missing elsewhere.

Do I need to add a join into the form?
Maybe I put wrong access?

Could you try this code and check if its really working?

This form is a Book rental form so I need to populate the address info using CB profile address.

Using Joomla 1.0X and Fabrik 1.0.6 (zip version)

Check the attach file to see if what I have done is ok.

Thanks
 

Attachments

  • 1.gif
    1.gif
    23 KB · Views: 268
I just noticed the "Maximum length" of that element is set to 0. Which effectively prevents Fabrik from entering any values in it.

-- hugh
 
Hi,

ok I have change it.

I thought: Maximum Length (leave blank for max length to equal field width):
But 0 is not blank' I guess it was set by default....

But it's not solving the problem the field is still blank
 
Hi,

I'm doing test locally on my PC.

I can upload other screenshot, tell me what you want to check...

Also, could you try this code on your system, just to make sure that it's working properly?
(Using Joomla 1.0X and Fabrik 1.0.6 (zip version))

PS I have found a piece of code from adsmanager who have this feature embed
here is the code

$database->setQuery("$sql FROM #__comprofiler as cb, #__city as city ".
"WHERE cb.user_id=".$my->id." AND u.id=".$my->id); $database->loadObject($city);

Thanks
 
Hughs' getting his code muddled

Here's what you need:

Code:
global $database, $my;
$database->setQuery("SELECT city FROM jos_comprofiler WHERE user_id = '" . $my->id . '");
return = $database->loadResult();

Rob is getting his code muddled. ;)

Take that = out of the return line.

-- hugh
 
Sheesh, how many errors can two supposed experts introduce into three lines of code?

The quotes on the SQL query line were also messed up. The following should work (sound familiar?):

PHP:
global $database, $my;
$database->setQuery("SELECT city FROM jos_comprofiler WHERE user_id = '" . $my->id . "'");
return $database->loadResult();

-- hugh
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Staff online

Members online

Back
Top