Re: What is wrong with this?
| From: | Ernest E Vogelsinger | Date: | Mon, 24 Feb 2003 09:45:40 +0000 |
| Subject: | Re: What is wrong with this? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-136867@lists.php.net to get a copy of this message | ||
At 10:37 24.02.2003, Miguel Brás said:
--------------------[snip]--------------------
>//logical request
>if ($nome) {
>$sql="aviao = '$nome' ";
>}
>if ($code) {
>$sql="code = '$code' ";
>}
> $query = "SELECT * FROM ssr WHERE";
> $query .= $sql;
--------------------[snip]--------------------
Hi,
I've copied only the relevant lines of your program.
The issue here is that your string concatenation results in
SELECT * FROM ssr WHEREaviao = 'Airbus'
Note the missing space after "WHERE". Your code should better read
$query = "SELECT * FROM ssr WHERE ";
$query .= $sql;
Have an eye on the added blank after WHERE.
HTH,
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/