Clueless as to why I keep receiving this error:
Could not Update You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1='test' WHERE ID='1'' at line 1
Any help is greatly appreciated
<?php
mysql_connect("localhost", "root", "root") or die("Error connecting to database: ".mysql_error());
mysql_select_db("stratacache") or die(mysql_error());
if(isset($_GET['edit']))
{
$id = $_GET['edit'];
$result = mysql_query("SELECT * FROM Test_Test_Wall_Sites");
$row = mysql_fetch_array($result);
}
if(isset($_POST['newName']) )
{
$newName = $_POST['newName'];
$id = $_POST['id'];
mysql_query("UPDATE Persons SET 'COL 1'='$newName' WHERE ID='$id'") or die("Could not Update".mysql_error());
echo "<meta http-equiv='refresh' content='0;url=index.php'>";
}
?>
<form action="edit_in.php" method="POST">
Name: <input type = "text" name="newName">
<input type="hidden" name="id" value="<?php echo $row[0]; ?>">
<input type="submit" value="CHECK IN">
</form>