Re: verify another flavor

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

 



Paul M Foster wrote:
> 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". 
The verification is to know if the author entered in the form already
exists in the db. The person or the script does not know the id without
querying the db. If the author exists in db the following directions
will take one route otherwise another. :-)
> 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()?
No fascination... thought it would simplify things. Now I know what it
is and how to use it.
Thanks. :-)
> Just say:
>
> $name = $first_name . ' ' . $last_name;
>
> or
>
> $name = "$first_name $last_name";
>
> Paul
>


-- 
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


[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