I know mysql is oudated like yahoo. but, I was asked to fix on a friends website. so first of all, heres the code:
<?php
$name = $_POST['name'];
$kcid = $_POST['kcid'];
$host="localhost"; // Host name
$username="username"; // Mysql username
$password="password"; // Mysql password
$db_name="dbname"; // Database name
$tbl_name="tablename"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// update data in mysql database
$sql="UPDATE $tbl_name SET lastname='$name' WHERE KcID='$kcid'";
$result=mysql_query($sql);
// if successfully updated.
if($result){
echo "Successful";
echo "<BR>";
}
else {
echo "ERROR";
}
?>
When i try to run it, it says sucessful but it doesnt edit anything at all talbe:
KcID | Kc | Lastname
I hope somone has a solution.
please correct my code if you see something that causes it not to work