Re: sql query

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

 



On Wed, 2 Mar 2005 13:02:39 +0200, William Stokes <kalles@xxxxxxxxxxxxx> wrote:
> Hello
> 
> Can someone explain this to me. I don't know how to read this.
> 
> if (!$variable = mysql_query("select id,sessid from users where ...
> 
> What is this "if(!"

This is a way to run a SQL query, capture the return value, and
perform an action if the query failed. For code readability, I would
probably write that as two statements:

$variable = mysql_query("SELECT * FROM blah");
if(!$variable) { error_handler(mysql_error()); }

See the documentation for information on mysql_query return values:
http://us2.php.net/manual/en/function.mysql-query.php

Jason

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