Recently I started to learn webdevelopment, and for the first project we have to make a very simple registration function. now I'm somewhere, but suddenly I started getting this error.
Cannot go to row 0 at MySQL 4 result index.
This is the code where I get the error.
$conn = mysql_connect($servername, $username, $password, $database) or die("!Server");
if(!$conn){
die("Connection error: " . mysql_error());
}else{
echo "connection made";
}
$select_db= mysql_select_db($database, $conn);
if(!$select_db){
die("Database selection failed:: " . mysql_error());
}else{
echo "database selected";
}
$login_user = $_GET['username'];
$select_password = "SELECT `password` FROM `members` WHERE `username` = '$login_user'";
$result = mysql_query($select_password);
if(!$result){
die("Could not fetch the data " . mysql_error());
}
$password = mysql_result($result, 0);
echo $password;
I know that there are other posts asking the same question, but none of them are very helpful.
I hope someone can help me.
Thanks for reading:)
source
share