What exactly is the error report?
here is a simple PHP/MySql code to insert/display user data..
<?php
mysql_connect("localhost", "root","") or die (mysql_error());
mysql_select_db("ajaxdatabase") or die(mysql_error());
if (isset($_POST['submit'])) {
$insert = "INSERT INTO user (firstname, lastname, age, hometown, job)
VALUES ('".$_POST['firstname']."', '".$_POST['lastname']."', '".$_POST['age']."', '".$_POST['hometown']."', '".$_POST['job']."', )";
$add_member = mysql_query($insert);
?>
SUCCESSFUL INSERT
<?php
}
else
{
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
First Name:<input type="text" name="firstname" />
Last Name:<input type="text" name="lastname" />
Age: <input type="text" name="age" />
Home Town:<input type="text" name="hometown" />
Job: <input type="text" name="job" />
<input type="submit" value="submit" name="submit"/>
</form>
<?php
}
?>
And to Display the data
<?php
mysql_connect("localhost", "user", "") or die (mysql_error ());
mysql_select_db("ajaxdatabase") or die(mysql_error());
$strSQL = "SELECT * FROM users ORDER BY Id DESC";
$rs = mysql_query($strSQL);
while($row = mysql_fetch_array($rs)) {
echo $row['Id'] . " " . $row['firstame'] . " " . $row['lastname'] . " " . $row['age'] . " " . $row['hometown'] . " " . $row['job'] . " " . $row['BirthDate'] . "<br />";
}
mysql_close();
?>