Jump to content

query not being executed


bruckerrlb

Recommended Posts

Hello!

 

I have a simple script here, that takes the value of a query, and inserts it into an option field, below

//I want to grab my session id here to put it in a variable (this session id is the member id, and I troubleshot it with a print statement, and it shows me the member id, which is the same as the client id)

 

$memberid = $_SESSION['SESS_MEMBER_ID'];

//This is my simple query to find make sure the client is only looking at his products

$query = 'SELECT * FROM products WHERE clientid = $memberid';

 

 

//basic loop here

if ($r = mysql_query ($query)) {

 

while ($row = mysql_fetch_array ($r)) {

 

print "

 

                      //for some reason it's not printing the product name row, which is associated with the user who is logged in, i'm stumped

<option>{$row['productname']}</option>";

 

 

 

}

 

}

 

else {

//I don't get this error, I just get nothing returned in the select statement

die ('could not do it because' .mysql_error(). "Damn");

}

mysql_close();

 

 

So that is my problem in a nutshell, is my logic wrong? If anymore info is needed, please let me know, and thanks in advance for the help

Link to comment
https://forums.phpfreaks.com/topic/63354-query-not-being-executed/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.