I contradicted with someone what is the right code to insert mysql_error and check if user exist or not.Here's 3 examples:
Number 1:
Number 2:
Number 3:
What you think is correct or if you have completions,please..
Number 1:
PHP Code:
$sql = "SELECT user, email, timereg FROM test WHERE user='".$user."'";
$items = @mysql_query($sql) or die(mysql_error());
if(@mysql_num_rows($items)>0)
{
while($item = @mysql_fetch_array($items))
{
echo "Hi ".$item['user']."";
}
}else{
echo "User not exist.";
}
PHP Code:
$sql = "SELECT user, email, timereg FROM test WHERE user='".$user."'";
$items = @mysql_query($sql) or die(mysql_error());
while($item = @mysql_fetch_array($items))
{
echo "Hi ".$item['user']."";
}
PHP Code:
$sql = "SELECT user, email, timereg FROM test WHERE user='".$user."'";
$items = @mysql_query($sql) or die(mysql_error());
$item = @mysql_fetch_array($items);
echo "Hi ".$item['user']."";
Comment