Jump to content

poliosynthesis

New Members
  • Posts

    3
  • Joined

  • Last visited

poliosynthesis's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi Guys, I am very sorry to have wasted your time, it was an error based on an incorrect mysql_query I entered the wrong name of the row. If you guys would like me to post my code for future reference for others with my problem I will. Sorry again to have wasted your time. Thanks for the help you did give me though
  2. Sorry Guys, I doubled up with my mysql_connects etc. I have since removed that, it is not the error. <?php $name = $_GET['name']; $password = $_GET['password']; if (!$name && $password) { echo "Error"; exit; } mysql_connect("localhost" , "root" , "") or die("Issue with connection!"); mysql_select_db("testlogin"); $query = "SELECT * FROM users WHERE Name='".$name."'"; $result = mysql_query($query); $numrows = mysql_num_rows($query); if($numrows !=0) { while($row = mysql_fetch_assoc($query)) { $dbname = $row['Username']; $dbpassword = $row['password']; } if($name == $dbname && $password == $dbpassword) { echo "you are in!"; }else { echo "Please enter a valid username and password"; } }else { echo "Your name is not registered!"; } ?>
  3. Hi Guys, I have a simple mysql_num_rows() expects parameter 1 to be resource, boolean given error in my script, I have tried to debug it myself but I don't understand why the script doesn't think the variable "$query" isn't an integer. I am trying to create a login form for users who are already registered and I want them to be able to see instant feedback as to whether their info has been accepted or not. The users won't be redirected though. testlogin.php <?php $name = $_GET['name']; $password = $_GET['password']; if (!$name && $password) { echo "Error"; exit; } mysql_connect("localhost" , "root" , "") or die("Issue with connection!"); mysql_select_db("testlogin"); $query = mysql_query("SELECT * FROM users WHERE Name='".$name."'"); $name = $_GET['name']; $password = $_GET['password']; if(!$name && $password) { echo 'No name or password'; exit(); } mysql_connect("localhost","root", ""); mysql_select_db("testlogin"); $query = mysql_query("SELECT * FROM users WHERE Name ='".$name."'"); $numrows = mysql_num_rows($query); if($numrows !=0) { while($row = mysql_fetch_assoc($query)) { $dbname = $row['Username']; $dbpassword = $row['password']; } if($name == $dbname && $password == $dbpassword) { echo "you are in!"; }else { echo "Please enter a valid username and password"; } }else { echo "Your name is not registered!"; } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.