Re: verify another flavor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



$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@xxxxxxxxxxxx> 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@xxxxxxxxxxxxx
>   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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux