Re: verify another flavor

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

 



On Fri, Mar 06, 2009 at 10:49:12AM -0600, haliphax wrote:


<snip>

> 
> I would go about it like this:
> 
> $sql1 = "select concat_ws(' ', first_name, last_name) as Author_Name
> from author where first_name = '$first_nameIN' and last_name =
> '$last_nameIN'";

If you already know the first_name and last_name and you're just
checking for their existence, then just query for some simple field like
"id". Then check for number of rows. If it's zero, it's not there.
There's no point in making MySQL return a value which you already know.

What is the fascination with using concat_ws()? Just say:

$name = $first_name . ' ' . $last_name;

or

$name = "$first_name $last_name";

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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