Re: verify another flavor
| From: | Bastien Koert | Date: | Fri, 06 Mar 2009 16:51:41 +0000 |
| Subject: | Re: verify another flavor | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-289478@lists.php.net to get a copy of this message | ||
$sql1 = "SELECT first_name, last_name) FROM author WHERE (first_name
LIKE 'first_nameIN' && last_nameIN LIKE 'last_nameIN')"
On Fri, Mar 6, 2009 at 11:36 AM, PJ <af.gourmet@videotron.ca> wrote:
> I know I'm a pain the butt but I just can't help asking for help. You
> guys are so nice... ;-)
> I am trying to do some checks if there are entries in the db so I can
> then insert the right stuff. And I'm looking for ways to simplify things.
> I probably dont understand the flow of things here, but this almost
> works. :-\
> $Author = $first_nameIN . ' ' . $last_nameIN;
> echo $Author;
> $sql1 = "SELECT CONCAT_WS(" ", first_name, last_name) as Author FROM
> author WHERE Author LIKE '$Author'";
> $result1 = mysql_query($sql1);
> this would be instead of
> $sql1 = "SELECT first_name, last_name) FROM author WHERE (first_name
> LIKE 'first_nameIN' && last_nameIN LIKE 'last_nameIN')"
>
> --
> unheralded genius: "A clean desk is the sign of a dull mind. "
> -------------------------------------------------------------
> Phil Jourdan --- pj@ptahhotep.com
> http://www.ptahhotep.com
> http://www.chiccantine.com/andypantry.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
You need the % operator for a like comparison
$sql1 = "SELECT first_name, last_name) FROM author WHERE (first_name
LIKE '%first_nameIN%' && last_nameIN LIKE '%last_nameIN%')"
but most likely, you really want a true comparison to see if that user
exists
$sql1 = "SELECT first_name, last_name) FROM author WHERE (first_name
= 'first_nameIN' && last_nameIN = 'last_nameIN')"
--
Bastien
Cat, the other other white meat