zoey_ann101
New member
i have a problem! tomorrow will be my deadline for my project..my project lacks updating code..i have it here..but the problem is it doesn't update in my database: please if someone could help me what the problem is...
<?php
require_once("dbconnect.php");
$dbRecords = mysql_query("SELECT * FROM tableusers", $Localhost)
or die("Problem Reading table:" .mysql_error());
if(isset($_POST["cmdSubmit"]))
{
$NUsername = $_POST["txtNUname"];
$OldPass = $_POST["pwdOld"];
$NPassword = $_POST["pwdNew"];
$NPassword2 = $_POST["pwdNew2"];
$dbRecords = mysql_query("SELECT * FROM tableusers WHERE Password ='$OldPassword'", $Localhost)
or die("Problem Reading table:" .mysql_error());
if($NPassword != $NPassword2)
{
die("Incorrect Password.");
}
$intRec = mysql_fetch_array($dbRecords);
if($intRec > 0)
{
$dbRecords = mysql_query("UPDATE tableusers SET Username = '$NUsername' AND Password = '$NPassword' WHERE Password ='$OldPass'", $Localhost)
or die("Problem Updating:" .mysql_error());
echo "SUCCESS!";
}
else
{
echo"Sorry can't update.";
}
}
?>
<?php
require_once("dbconnect.php");
$dbRecords = mysql_query("SELECT * FROM tableusers", $Localhost)
or die("Problem Reading table:" .mysql_error());
if(isset($_POST["cmdSubmit"]))
{
$NUsername = $_POST["txtNUname"];
$OldPass = $_POST["pwdOld"];
$NPassword = $_POST["pwdNew"];
$NPassword2 = $_POST["pwdNew2"];
$dbRecords = mysql_query("SELECT * FROM tableusers WHERE Password ='$OldPassword'", $Localhost)
or die("Problem Reading table:" .mysql_error());
if($NPassword != $NPassword2)
{
die("Incorrect Password.");
}
$intRec = mysql_fetch_array($dbRecords);
if($intRec > 0)
{
$dbRecords = mysql_query("UPDATE tableusers SET Username = '$NUsername' AND Password = '$NPassword' WHERE Password ='$OldPass'", $Localhost)
or die("Problem Updating:" .mysql_error());
echo "SUCCESS!";
}
else
{
echo"Sorry can't update.";
}
}
?>