Jump to content

Recommended Posts

if the var is hard coded it is fine

im getting the session var as well

 

$userid is echoed but not affecting the query

echo $userid=$_SESSION['userid'];
mysql_select_db($database_sp, $sp);
$query_RsgetApID = 'SELECT * FROM users LEFT JOIN bookings_admin_users ON bookings_admin_users.username = users.username WHERE users.userid='.$userid.' LIMIT 0 , 30 ';

Link to comment
https://forums.phpfreaks.com/topic/238486-query-not-getting-var/
Share on other sites

oh well since you seem to be using a string, you need to surround your $userid variable with quotes. This is assuming ur userid column is of type varchar

 

$query_RsgetApID = "SELECT * FROM users LEFT JOIN bookings_admin_users ON bookings_admin_users.username = users.username WHERE users.userid='.$userid.' LIMIT 0 , 30 ";

 

unless thats some sort of hex typed column or something, but the default type for hex numbers in mysql is a string if I remember correctly

oh well since you seem to be using a string, you need to surround your $userid variable with quotes. This is assuming ur userid column is of type varchar

 

$query_RsgetApID = "SELECT * FROM users LEFT JOIN bookings_admin_users ON bookings_admin_users.username = users.username WHERE users.userid='.$userid.' LIMIT 0 , 30 ";

 

unless thats some sort of hex typed column or something, but the default type for hex numbers in mysql is a string if I remember correctly

 

ok found the solution, silly syntax i put the var inside '".$userid."' 

$query_RsgetApID = "SELECT * FROM users LEFT JOIN bookings_admin_users ON bookings_admin_users.username = users.username WHERE users.userid='".$userid."' LIMIT 0 , 30 ";

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.