Heya, I get these 2 errors:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/themepar/public_html/changepass.php on line 20
You have not entered all the fields
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/themepar/public_html/changepass.php on line 34
Sorry You failed to enter the correct old password
I was wondering if anyone could help me, I have said where the lines are,
Please help,
[PHP]<?php
// Mysql
include ('mysql_connect.php');
//
$oldpass=$_POST['oldpass'];
$newpass=$_POST['newpass'];
$cnewpass=$_POST['cnewpass'];
$numrows = mysql_num_rows($res);
//
if (($oldpass==NULL)||( $newpass==NULL)||( $cnewpass==NULL)) {
echo "You have not entered all the fields";
}else{
}
//
if($newpass!=$cnewpass) {
echo "Passwords do not match";
} else {
}
//
$sql = "UPDATE users SET password = '".md5($newpass)."' WHERE username = '".$_SESSION['s_username']."' AND password = '".md5($oldpass)."' ";
$res = mysql_query($sql,$dbc) or die (mysql_error());
$numrows = mysql_num_rows($res);
if ($numrows >0) {
echo "your password has been changed ";
} else {
echo "Sorry You failed to enter the correct old password";
}
mysql_query($sql,$dbc) or die (mysql_error());
?>[/PHP]