Jump to content

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

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.