Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2001071

[PHP-DB] Re: A very simple MySQL + PHP error From: Hugh Bothwell (hugh_bothwell <email protected>)
Date: 07/08/01

"Brad Lipovsky" <syzme <email protected>> wrote in message
news:20010708182828.84349.qmail <email protected>
> I get the following error:
>
> $Query = "SELECT * from $TableName WHERE title LIKE "%$title%")";

If you tried 'echo $Query' right here, you wouldn't see anything.

Try 'echo "305" % "300";'

You begin to see the problem, right? You used double quotes within your
string without escaping them (ie \") - so PHP treated it as the end of the
string. You would have gotten an error message, except that % is PHP's
modular division operator - so it tried to convert the strings to numbers
and do modular division on them.

How 'bout
$query = "SELECT * FROM $table WHERE title LIKE '%$title%' ";

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>