I'm trying to update my MySQL Table via PHP - It says successful, but isn't actually updating. Here is snippets of my PHP code used;
List of rows in my Table.
<?php
$sql="SELECT * FROM $tbl";
$result=mysql_query($sql);
while($rows=mysql_fetch_array($result)){
echo $rows['title'];
echo $rows['date'];
echo $rows['month'];
?>
<a href="update.php?id=<? echo $rows['id']; ?>">update</a>
Edit Forum
<?php
$id=$_GET['id'];
$sql="SELECT * FROM $tbl WHERE id='$id'";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
?>
<form name="form" method="post" action="update.php">
<input name="title" type="text" id="title" value="<? echo $rows['title']; ?>">
<input name="date" type="text" id="date" value="<? echo $rows['date']; ?>" >
<input name="month" type="text" id="month" value="<? echo $rows['month']; ?>">
<input name="id" type="hidden" id="id" value="<? echo $rows['id']; ?>">
<input type="submit" name="Submit" value="Submit">
Process of the Table update
<?php error_reporting(E_ALL); ini_set('display_errors', 1); //added to all pages
$title = $_POST['title']
$date = $_POST['date']
$month = $_POST['month']
$id = $_POST['id']
$sql="UPDATE $tbl SET title='$title', date='$date', month='$month' WHERE id='$id'";
$result=mysql_query($sql);
if (!$sql) {
die(mysql_error());
}
?>
If I update my table directly running SQL Queries in PhpMyAdmin it works perfectly fine. But when I do it through PHP it outputs as successful but doesn't actually change the data. Where am I going wrong?
PS: I have tried using mysql_error()); but nothing reports back.