samedi 25 avril 2015

error on php code line 17 please heelp [on hold]


please i dont know what is wrong with my code on line 17
<?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 * FROM users WHERE username = ? OR email = ?');
                $query = $query->execute(array(
                        $username,
                        $email
                        ));
                $count = mysql_num_rows($query); //this is the line 17 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\my php\work\register.php on line 17
                if($count == 0){
                
                        $query = $dbc->prepare('INSERT INTO users SET username= ? , email= ?, passowrd= ?');
                        $query = $query->execute(array(
                                $username,
                                $email,
                                $password
                                ));
                        if($query){
                                echo "you have been registered succesfully plese click here to login";
                        }
            }else{
                echo "user already exist with that username";
                }
        }else{
                echo "password is 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>

Aucun commentaire:

Enregistrer un commentaire