My php query will not work!! PLEASE HELP!!?

  • Thread starter Thread starter Tamayi M
  • Start date Start date
T

Tamayi M

Guest
try this:

$res = mysql_query("SELECT * FROM cart WHERE gst_id = '".$sescart."'")

I think you are not concatenating the variable to build the dynamic query properly. I havent done PHP in quite a while... but I think that's the issue.
 
I am trying to query a number with variables it's supposed to be quite simple but ive sat here for hours thinking where has it all gone wrong!! Here is a snippet of my code any help would be much appriciated. I am using ajax to output this query everything else works eccept this query
the $sescart = a current session which is just a random number kept in my database I just want it to query the gst_id where the variable = $sescart from my shopping cart called cart. The gst_id is exactly the same as the $sescart so I do not know why it's not working and this is crucial for my site.

$res = mysql_query("SELECT * FROM cart WHERE gst_id = '$sescart'") or die(mysql_error());

while($row = mysql_fetch_array($res))
{
$name = $row['gst_id'];

echo"$name<br>";
}
 
Back
Top