0
<?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

3
Contributors
3
Replies
14
Views
4 Years
Discussion Span
Last Post by Benjamin_4
0

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

0

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

Edited by Dani: Formatting fixed

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.