Hello. I made a couple of PHP scripts to insert and update data, but they do not work. Why?
<?php
$id = $_POST['id'];
$cont = $_POST['elm1'];
$head = $_POST['header'];
$tit = $_POST['title'];
$cxn = mysqli_connect("localhost","********","*******","msuck");
$query = "UPDATE articles SET title='$tit', header='$head', content='$cont' WHERE id='$id'";
$result = mysqli_query($cxn, $query);
?>
<html>
<head>
<script type="text/javascript">
window.location = "index.php?loc=msuck&id=<?php echo $id; ?>";
</script>
</head>
</html>
UPDATE script
<?php
$id = $_POST['id'];
$cont = $_POST['elm1'];
$head = $_POST['header'];
$tit = $_POST['title'];
$dat = date('Y-m-d');
$tim = date('H:i:s');
$cxn = mysqli_connect("localhost","********","*******","msuck");
$query = "INSERT INTO articles (content,id,author,date,time,title,header) VALUES ($cont,$id,'Administrator',$dat,$tim,$tit,$head)";
$result = mysqli_query($cxn, $query);
header("Location: index.php?loc=msuck&id={$_POST['id']}");
?>
INSERT script
Sorry if you notice "elm1", I'm using a TinyMCE editor.
I notice no problems, and I feel that I followed it the same way that the book I'm using (PHP & MySQL Web Development All In One Desk Reference for Dummies, 3rd Edition by Janet Valade, ISBN: 978-0-470--16777-9) does. Do you have any answers?