On Wednesday 25 July 2001 23:05, Seb Frost wrote:
Thanks for the suggestion but it's too ugly for me :-) I'll just stick
with using '. I don't forsee a problem.
$query = SELECT shoodID FROM shoots WHERE location='$location';
wget
Driving me mad. Works if I put a string in quote marks instead of the
variable $location.
$result = mysql_query(SELECT shootID FROM shoots WHERE
(location=$location));
This should work shouldn't it? If it's a problem with the variable being
embedded in the query what's the easiest way to
hmmm i think you need to always have quotes around string regardless of if
they are variables . . .
$result = mysql_query(SELECT shootID FROM shoots WHERE
(location='$location'));
- Original Message -
From: Seb Frost [EMAIL PROTECTED]
To: php-general [EMAIL PROTECTED]
Sent: Thursday,
IMHO
$query = SELECT shoodID FROM shoots WHERE location=\$location\;
and even
$query = SELECT shoodID FROM shoots WHERE location='$location';
sometimes cause SQL Syntax Error,
because the variable $location may contain quote characters (')()...
since i experienced the same thing i've been
True, that's because mySQl doesn't understand it without the signle quotes,
or any descent database for that matter.
BC
-Original Message-
From: Jon Yaggie [mailto:[EMAIL PROTECTED]]
Sent: woensdag 25 juli 2001 22:12
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Why doesn't this simple query
PROTECTED]]
Sent: July 26, 2001 4:59 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Why doesn't this simple query work?
IMHO
$query = SELECT shoodID FROM shoots WHERE location=\$location\;
and even
$query = SELECT shoodID FROM shoots WHERE location='$location';
sometimes cause SQL Syntax Error,
because
yes,
both of yours make the same result too, and are clean :-)
and i wonder what the best way is, to put queries into php code...
there's a more complicated sample,
$a=addslashes($a);
$b=addslashes($b);
$c=addslashes($c);
if( $another_table ) { $another_table=','.$another_table; }
$query =
]
Subject: [PHP] how do you write queries in php codes? (was Re: [PHP] Why
doesn't this simple query work?)
yes,
both of yours make the same result too, and are clean :-)
and i wonder what the best way is, to put queries into php code...
there's a more complicated sample,
$a=addslashes($a);
$b
8 matches
Mail list logo