Perad Posted May 2, 2007 Share Posted May 2, 2007 This is to check if the user Alias is already taken. However if the name is in there or not it still returns the error saying it is. What can i change so it only flags up when the user actually isn't in there. $sql="SELECT * FROM blog_members WHERE user_alias='$this->userAlias'"; $result = mysql_query($sql); if ($result) { echo " - Error 5005 - This username is taken!"; $this->error[] = 1; } Link to comment https://forums.phpfreaks.com/topic/49667-solved-simple-mysql-problem/ Share on other sites More sharing options...
trq Posted May 2, 2007 Share Posted May 2, 2007 <?php $sql="SELECT * FROM blog_members WHERE user_alias='$this->userAlias'"; $result = mysql_query($sql); if ($result) { if (mysql_num_rows($result)) { echo " - Error 5005 - This username is taken!"; $this->error[] = 1; } } ?> Link to comment https://forums.phpfreaks.com/topic/49667-solved-simple-mysql-problem/#findComment-243501 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.