Huvvud Posted April 25, 2013 Share Posted April 25, 2013 Im having a problem with this, if anyone could help i would be greatful Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/hkdropbo/public_html/Register.php on line 28 <?php require('config.php'); if(isset($_POST['submit'])){ // perform the verification $email1 = $_POST['email1']; $email2 = $_POST['email2']; $pass1 = $_POST['pass1']; $pass2 = $_POST['pass2']; if($email1 == $email2) { if($pass1 == $pass2){ //all good, carry on $name = mysql_escape_string($_POST['name']); $lname = mysql_escape_string($_POST['lname']); $uname = mysql_escape_string($_POST['uname']); $email1 = mysql_escape_string($email1); $email2 = mysql_escape_string($email2); $pass1 = mysql_escape_string($pass1); $pass2 = mysql_escape_string($pass2); //////// 28.----------- $pass1 = md5($pass1); //kollar så ingen annan användare med samma användarnamn finns $sql = mysql_query("SELECT * FROM `users` WHERE `uname` = '$uname'"); if(mysql_num_rows($sql) >0){ echo "Sorry, that user already exists."; exit(); } //////////////////28.-------------- mysql_query("INSERT INTO `users` (`id`, `name`, `lname`, `uname`, `email`, `pass`) VALUES (NULL, '$name', '$lname', '$uname', '$email1', '$pass1')"); }else{ echo "Sorry, your passwords do not match.<br>"; exit(); } }else{ include "regform.php"; //$form = <<<EOT //EOT; //echo $form; }} ?> Link to comment https://forums.phpfreaks.com/topic/277296-help-plz-warning-mysql_num_rows-expects-parameter-1-to-be-resource-boolean-given-in-homehkdropbopublic_htmlregisterphp-on-line-28/ Share on other sites More sharing options...
jugesh Posted April 25, 2013 Share Posted April 25, 2013 $sql = "Your Query";$result = mysql_query($sql) or die(mysql_error()); $numRes=mysql_num_rows($result); if($numRes>0){ echo "Sorry, that user already exists."; exit(); } Link to comment https://forums.phpfreaks.com/topic/277296-help-plz-warning-mysql_num_rows-expects-parameter-1-to-be-resource-boolean-given-in-homehkdropbopublic_htmlregisterphp-on-line-28/#findComment-1426524 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.