mysql - need help on this php code line 17 -
this question has answer here:
have tried on line 17 please need write (pdo) code because signup input not going database
warning: mysql_num_rows(): supplied argument not valid mysql result resource in c:\wamp\www\my php\work\register.php on line 17 //please need code make right have tried know <?php include "scripts/connection.php"; //error_reporting(0); $email = $_post['email']; $username = $_post['username']; $password = md5($_post['password']. "al552kao09"); $confpassword = md5($_post['confpassword']. "al552kao09"); echo"text"; if (isset($email, $username, $password, $confpassword)){ if (strstr($email, "@")){ if ($password == $confpassword){ $query = $dbc->prepare('select * users username = ? or email = ?'); $query = $query->execute(array( $username, $email )); $count = mysql_num_rows($query); //this line 17 if($count == 0){ $query = $dbc->prepare('insert users set username= ? , email= ?, passowrd= ?'); $query = $query->execute(array( $username, $email, $password )); if($query){ echo "you have been registered succesfully plese click here login"; } }else{ echo "user exist username"; } }else{ echo "password not matching"; } }else{ echo "invalid email address"; } } ?> <html> <head> <form action="" method="post"> <table border="0" width="500" align="center" cellpadding="5px"> <tr> <td colspan="2" style="background:#993300;color:#fff"> login </td> </tr> <tr> <td> email </td> <td> <input type="text" name="email"/> </td> </tr> <tr> <td> username </td> <td> <input type="text" name="username"/> </td> </tr> <tr> <tr> <td> password </td> <td> <input type="password" name="password"/> </td> </tr> <tr> <td> confirm_password </td> <td> <input type="password" name="confpassword"/> </td> </tr> <tr> <tr> <td colspan="2"> <center> <input type="submit" name="submit" value="register"/> </center> </td> </tr> <tr> <td colspan="2"> <form> </head> </html>
you can't use pdo , mysql together, in example row count's try this:
$count = $query->rowcount();
Comments
Post a Comment