Append a variable (from a MySQL query) to a url variable

Codes here !

Moderators: egami, macek, gesf

Post Reply
johnj
php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Thu Mar 14, 2013 5:05 am

After $db->setQuery(), you need to run the query and get the user id to a variable and use that variable.
For example, it could be something like this:

Code: Select all

$sqlQuery = "SELECT `user_id` FROM `#__briefcasefactory_files` WHERE `user_id`='".$my->get('id')."' LIMIT 1"";
$myResult = mysql_query($sqlQuery);

$resObj = mysql_fetch_object($myResult);
$user_id_variable = $resObj->user_id;
I have not tested the above code, but with a few teaks it should work.

johnj
php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Thu Mar 14, 2013 5:07 am

If you need an example of getting data from a table then please take a look at this example:
http://phillipnb.wordpress.com/2010/12/ ... -resource/

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests