I wrote this as part of a PHP lesson I am doing. I cannot get it to work!! I have checked all of my server and database settings, everything seems to be in order. The Database username and password are correct. I have even re-written the snippet three times. Can someone tell me if the source code is outdated as to the reason it is not working? The PHP version running on my server is 4.3.1 and I am using phpMyAdmin as the tool. Any help would be greatly appreciated. Thanks in advance.
PHP Code:
<?php
$first_name=$_POST['firstname'];
$last_name=$_POST['lastname'];
$when_it_happened=$_POST['whenithappened'];
$how_long=$_POST['howlong'];
$how_many=$_POST['howmany'];
$alien_description=$_POST['aliendescription'];
$what_they_did=$_POST['whattheydid'];
$fang_spotted=$_POST['fangspotted'];
$email=$_POST['email'];
$other=$_POST['other'];
$dbc=mysqli_connect('mysql','username','password','aliendatabase')
or die('Error connecting to MySQL server.');
$query="INSERT INTO aliens_abduction (first_name, last_name, when_it_happened, how_long,".
"how_many, alien_description, what_they_did, fang_spotted, other, email)".
"VALUES ('$first_name', '$last_name', '$when_it_happened','$how_long','how_many',".
"'alien_description','$what_they_did','$fang_spotted','$other','$email')";
$result=mysqli_query($dbc,$query)
or die('Error querying database.');
mysqli_close($dbc);
echo 'Thanks for submitting the form.<br/>';
echo 'You were abducted'.$when_it_happened;
echo 'and were gone for'.$how_long.'<br/>';
echo 'Number of aliens:'.$how_many.'<br/>';
echo 'Describe them:'.$alien_description.'<br/>';
echo 'The aliens did this:'.$what_they_did'<br/>';
echo 'Was Fang there?'.$fang_spotted'<br/>';
echo 'Other Comments:'.$other'<br/>';
echo 'Your email address is:'$email;
?>