$query="select id from myTable1 where title='[COLOR="Red"]title1[/COLOR]' " ;
The code above works fine.
when I change “where clause” from the code above like the code below, I met Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in dbAction1.php .
$query="select id from myTable1 where title=[COLOR="red"]$myVar[/COLOR] " ;
How can I put a variale in where clause without Warning?
What about session variable in where clause?
The following code seems not to work correctly.
[b]code1[/b]
$query="select id from myTable1 where title='$_SESSION([COLOR="Red"]"[/COLOR]$myVar[COLOR="red"]"[/COLOR])' " ;
[b]result1[/b]
Parse error: syntax error, unexpected T_VARIABLE
[b]code2[/b]
$query="select id from myTable1 where title='$_SESSION([COLOR="Red"]'[/COLOR]$myVar[COLOR="red"]'[/COLOR])' " ;
[b]result2[/b]
// It doesn't call the value of the id column.