Jump to content

Help pls.


jushiro

Recommended Posts

I dont know why my code is not inserting the values..

Someone help pls.

 

<?php
session_start();  
if(isset($_SESSION['owner']) ) {

$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("feedbackdb", $con);

$from = $_POST['from'];
$type = $_POST['type'];
$feedback = $_POST['feedback'];
$owner = $_SESSION['owner'];


$from = stripslashes($from);
$type = stripslashes($type);
$feedback = stripslashes($feedback);
$owner = stripslashes($owner);

$from = mysql_real_escape_string($from);
$type = mysql_real_escape_string($type);
$feedback = mysql_real_escape_string($feedback);
$owner = mysql_real_escape_string($owner);

		mysql_query("INSERT INTO Feedbacks (Feedback, From, To,  Type,)
		VALUES ('$feedback', '$from', '$owner','$type')") or die(mysql_error);

/*echo '<script type="text/javascript">
{alert("Feedback successfully Added");}
</script>'; 
//echo '<meta http-equiv="REFRESH" content="0;url=Profilepage.php">';*/
}

else {
header("location:buysection.php");;
}
?>

            

Link to comment
https://forums.phpfreaks.com/topic/261520-help-pls/
Share on other sites

Hello, you have the following query:

mysql_query("INSERT INTO Feedbacks (Feedback, From, To,  Type,) VALUES ('$feedback', '$from', '$owner','$type')") or die(mysql_error);

after Type you put in a comma although there is nothing else after that

so it should be something like

"SELECT INTO `Feedbacks` (`Feedback`, `From`, `To`, `Type`) VALUES('$feedback', '$from', '$owner', '$type')"

Link to comment
https://forums.phpfreaks.com/topic/261520-help-pls/#findComment-1340045
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.