<?php 
$connect = mysql_connect("localhost","root","bank1991");
$select_it = mysql_select_db("shalom presbyterian church",$connect);
?>
<html>
<head>
</head>
<body>
<?php

$full_name = mysql_real_escape_string($_POST['fullname']);
$Phone_number = mysql_real_escape_string($_POST['pnumber']);
$Email_address = mysql_real_escape_string($_POST['emailAddress']);
$Comment_Questions = mysql_real_escape_string($_POST['feedback']);


$addquery = "INSERT INTO contact_feedback(full_name,Phone_number,Email_address,Comment_Questions) 
VALUES('{$full_name}','{$Phone_number}','{$Email_address}','{$Comment_Questions}";

if($addStaff = mysql_query($addquery,$connect)){
echo "Feedback have been successfully sent <br>";
echo "<a href = \"contact.html\">Back to admin home.</a>";
}
else{
echo "Sorry, Failed to send. Please try again by adding the correct details <br>";
echo "<a href = \"http://localhost/Shalom Presbyterian Church/contact.html
\">Please Try Again.</a>";
}

?>

</body>
</html>
<?php
mysql_close($connect);
?>

i am having problem inserting into my database(mysql)
it does not insert into the database there returning the second echo message
i dnt know what am doing wrong. i would appreciate the help please

maybe it's because of a missing closing parenthesis on the VALUES part? :3

Hello Benjamin,

Try:

$addquery = "INSERT INTO contact_feedback(full_name,Phone_number,Email_address,Comment_Questions) VALUES ('$full_name','$Phone_number','$Email_address','$Comment_Questions')";

and watch for the closing brackets !

/Hans

@athelas thanx it worked!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.