Hi there:
I cannot get a variable to evaluate properly in a select statement. I have confirmed that the variable $center_ref is getting assigned a value of 1 by an echo statement. I have also confirmed that when putting the value of the variable directly in the code I get the desired results. Here is the code snippet:
while ($games = mysql_fetch_array($game)) {
$id = $games['id'];
$date = $games['date'];
$time = $games['time'];
$hometeam = $games['hometeam'];
$visitingteam = $games['visitingteam'];
$field = $games['field'];
$center_ref = $games['center_ref']; (Following is the part I need help with)
$pick1= @mysql_query('Select firstname, lastname FROM refs
WHERE id="$center_ref"'); (This does NOT work)
$pick1= @mysql_query('Select firstname, lastname FROM refs
WHERE id=1; (This works)
Any help would be appreciated.
Thank you in advance,
Dave
Help with Select statement in PHP code please
Moderator: General Moderators
Re: Help with Select statement in PHP code please
Code: Select all
$pick1= @mysql_query('Select firstname, lastname FROM refs
WHERE id="$center_ref"'); (This does NOT work)Code: Select all
$pick1= @mysql_query("Select firstname, lastname FROM refs
WHERE id='$center_ref' "); (This does NOT work)Re: Help with Select statement in PHP code please
Yes that worked. Thank you VERY much 