Cookie and MySQL Query
Posted: Tue Apr 06, 2004 8:07 pm
Im having a bit of a problem searching a mysql database with a value in a cookie...The cookie is storing the user name as "username" and I would like it to search a table "users" for the results when they match "username"
this is what I have so far:
Admin Edit: Added tags to code for readability.[/color]
Im assuming the problem lies in the line that begins with "$query_Recordset1" but not sure what should be there...
thanks for help!
this is what I have so far:
Admin Edit: Added
Code: Select all
Code: Select all
<? $user = $HTTP_COOKIE_VARS["username"];?>
<?php
mysql_select_db($database_etst, $etst);
$query_Recordset1 = "SELECT city FROM users where $user = username ";
$Recordset1 = mysql_query($query_Recordset1, $etst) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Re
cordset1 = mysql_num_rows($Recordset1);
?>
<?php echo $row_Recordset1['user']; ?>thanks for help!