Welcome Guest, Not a member yet? Register   Sign In
Quick MySQL validation question
#1

[eluser]EdgeTube[/eluser]
Hi there,

Quick question; probably doing something wrong that I'm missing.
Here's the code that I have:

Code:
$query = $this->db->query("SELECT username FROM user_table WHERE (username='$name' OR username='$lowercasename')");
  
     if ($row->username = $name)
     {
foreach ($query->result() as $row)
{
     $profileid = $row->username;
?>
<?="$profileid";?> exists.
<?  }} else {  ?>
    echo "user doesn't exist";
    <?  }
   }
?>

Yeah my indentation is terrible but I'll format that haha.

This is supposed to check the passed data['name'] and check that against the database to see if the user exists, and as you can see above, it echos when a user exists or not.

However, the 'else' part of the function doesn't seem to be working or displaying anything...

Thanks!


Messages In This Thread
Quick MySQL validation question - by El Forum - 03-26-2010, 08:06 PM
Quick MySQL validation question - by El Forum - 03-26-2010, 08:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB