WilliamMute007
Programmer
Can anybody please help my foolishness pls? For the life of me, I cant really spot why my DB is not updating.
Please help
Code:
<?php
//turn on error tracking
ini_set('display_errors', true);
error_reporting(E_ALL);
//get connection variables
require_once('connection.php');
//connect to database server
mysql_connect($hostname_Connection, $username_Connection, $password_Connection) or die("Unable to connect to db " . mysql_error());
//connect to database
mysql_select_db($database_Connection)
or die("unable to select database. ". mysql_error());
//check if form submitted
if(isset($_POST['submit'])){
//create escaped variables
$heading = mysql_real_escape_string($_POST['heading']);
$summary = mysql_real_escape_string($_POST['summary']);
$news = mysql_real_escape_string($_POST['news']);
$author = mysql_real_escape_string($_POST['author']);
//construct query
$query="INSERT INTO `voiceofhop3`.`news` (`id`,`heading`,`summary`,`news`,`author`, `date`) VALUES (NULL,'$heading','$summary','$news','$author',NOW())";
//run query
$result=mysql_query($query);
if (!$result) { die (mysql_error()); }
//success
die("<META http-equiv=\"Refresh\" content=\"0;url=/index.php\">");
echo "Process successful";
} else {
echo 'Please referesh your browser';
echo "<hr/> hmmmm <br/><pre>" . print_r($_POST, true);
}
?>
Please help