12-31-2012, 10:03 PM
Dear LCKB Community :3
I want to start to learn "MySQL"...
Now I have found on YouTube a video
(How To make a Login and Register System in PHP) and is everything okay so far..., nevertheless, if I want to connect with the DB a mistake always comes although everything is properly:S
Login Control (only PHP):
<title>Login</title>
<form action="login2.php" method="post">
<table>
<Tr>
<td>Username: </td>
<td><input type="text" name="username" ></td>
</Tr>
<Tr>
<td>Password: </td>
<td><input type="password" name="password" ></td>
</Tr>
<Tr>
<td><input type="submit" name="loginbtn" value="Login"></td>
<td><a href="newregister.php">Register</a></td>
</Tr>
</table>
Login Script (Not yet ready but with Error):
<?php
$user_id = $_POST['username'];
$passwd = $_POST['password'];
if($user_id && $passwd){
$connect = mysql_connect("localhost","root","");
mysql_select_db("ep1_db_auth");
$query = mysql_query("SELECT * FROM bg_user WHERE username='$user_id' && password='$passwd'");
$numrows = mysql_num_rows($query);
echo("$numrows");
}
else
echo("Bitte geben sie ihre Daten ein.");
?>
I get this mistake over and over again; "Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in D:\xampp\htdocs\login2.php on line 9"
Hope somebody can help me :S
~SmoGG.
