SQL Server version: 5.0.51a
Raw SQL, php var omitted:
SELECT * FROM quote WHERE quote LIKE '%apple%'
This code executes fine. 'quote' is the name of the table, in addition to being the name of a col in 'quote'.
This really should be quite simple, and the above code executes without problem in phpmyAdmin, however, when used with this code:
$result = mysql_query("SELECT * FROM quote WHERE quote LIKE '%$find%'");
if (@mysql_query($result)){
while($row = @mysql_fetch_array($result)){
echo $row['quote'];
}
It doesn't get past the if statement and gives me this:
mySQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #3' at line 1
I've echo'd the SQL query as a variable, with the php variable $find, and it prints correctly. It's a valid query. But I still get the syntax error above. Any ideas?
Thanks in advance,
Daed
ps. I'm very new to php and mysql, my apologies if it's a simple mistake.