database (slightly ot)
| From: | Ryan A | Date: | Thu, 08 May 2003 14:45:53 +0000 |
| Subject: | database (slightly ot) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-146849@lists.php.net to get a copy of this message | ||
Hi,
I have been going through the code that the last developer left behind and I
see this:
if(isset($sname)&&$sname && isset($surl)&&$surl )
{
if($db->query("Select 1 from $site_table where (nick='$sname' or
address='$surl') and userid = $userid ") && $db->get_num_rows() > 0 )
{
$error = "A site with this nick/address already exists for this
user.<br> Pleasy try again with a different nick/address.";
}
I have two questions (kind of newbie so watch out)
1)Whis is it "select 1 from...." isnt it supposed to be "select * from..."
2) A little confused here "&& $db->get_num_rows() > 0 )" how can you assign
a pointer like that?
Kindly reply,
-Ryan