MySQL database is not getting populated
Posted: Wed Oct 17, 2012 5:45 pm
I am using wamp server on windows 7 home premium.
When following php script is run on server, it runs fine without ay error. But when I check the database table, I find it empty. So table is not getting populated by the script. Why is that ? Whats wrong in here ?
Thanks
When following php script is run on server, it runs fine without ay error. But when I check the database table, I find it empty. So table is not getting populated by the script. Why is that ? Whats wrong in here ?
Code: Select all
<html>
<head>
</head>
<body>
<?php
$fname = $_POST['firstname'];
$lname = $_POST['lastname'];
$email = $_POST['emailid'];
$when = $_POST['happenedon'];
$howlong = $_POST['gonefor'];
$whosaw = $_POST['seenby'];
$description = $_POST['describe'];
$what = $_POST['whatdidtheydo'];
$add = $_POST['anythingtoadd'];
echo "Your first name is ".$fname."<br />";
echo "Your last name is ".$lname."<br />";
echo "Your email is ".$email."<br />";
echo "Your dog is gone since ".$when."<br />";
echo "Your dog is gone for ".$howlong."<br />";
echo "Your dog was seen by ".$whosaw."<br />";
echo "Your dog looked ".$description."<br />";
echo "They ".$what."<br /><br />";
echo "Thanks for Reporting Abduction" ;
echo "report is sent" ;
$connect = mysqli_connect('localhost', 'root', '', 'phptest') or die ("Error connecting to database") ;
$query1 = "insert into gwar (firstname, lastname) values ($fname, $lname)";
mysqli_query($connect, $query1);
?>
</body>
</html>