|
Posted by JDS on 10/22/01 11:25
On Tue, 30 Aug 2005 02:45:54 -0700, Alec wrote:
> Problem solved with ('SELECT name FROM site01_details WHERE town
> LIKE "Bury"');
Your SQL statement should:
* use single quotes around the value after LIKE
http://dev.mysql.com/doc/mysql/en/string-syntax.html
* There really is no reason to use LIKE if you do not use wildcards -- the
percent sign "%". Use equals "=" instead
Your SQL statement should look like:
$sql_statement = "SELECT name FROM site01_details WHERE town = 'Bury'";
You are best off putting the SQL statment in a variable and putting the
variable into the mysql_query() function:
$result = mysql_query($sql_statement);
(I don't know why some books don't do this straight away, or at all. It
doesn't make sense to me to teach something one way and then un-teach it
later.)
I have other comments on coding style and whatnot but this is enough for
now, I imagine.
COWS
--
JDS | jeffrey@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/
Navigation:
[Reply to this message]
|