Re: Problem with string comparison
| From: | Ernest E Vogelsinger | Date: | Thu, 13 Mar 2003 22:08:03 +0000 |
| Subject: | Re: Problem with string comparison | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139612@lists.php.net to get a copy of this message | ||
At 22:31 13.03.2003, Charles Kline said:
--------------------[snip]--------------------
>I am trying to get this sql query to work and am getting the error
>"Insufficient data supplied". Can anyone help with this?
>
>$sql = "SELECT id, concat(fname, ' ', lname, ' ', degree1) name
> FROM tbl_personnel "WHERE name LIKE \'%";
>$sql .= $attributes['nametofind'];
>$sql .= "%\' ORDER BY lname ASC";
>
>What I am trying to do is allow the user to find a personnel record
>that contains the name to find.
--------------------[snip]--------------------
At the first glance I see 3 items where the first one might be the culprit:
- if your query is exactly as you sent it here you're missing a comma after
the closing bracket of "concat()", just before "name"
- before constructing the query make sure $attributes['nametofind'] is
formatted correctly, esp. correctly escaping single quotes
- when using double quotes to construct a string you don't need to escape
single quotes.
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/