Data not making it into mysql database
Posted: Mon Nov 23, 2009 4:03 pm
Hello, I read on how to post here and so I am providing the below info:
Magic quotes are disabled
PHP Version: 5.1.6
Display Errors: Off
Error Level: Not E_ALL
Register Globals: Off
Here is my issue:
I have a form on a webpage with a hidden input field, and a select field. I am using jquery to collect the data from those fields and post it to my php script which inserts it into the database. I'm pretty sure my javascript is working because I can use the print_r() command and it has the correct, updated data values from my fields everytime I test it, but the data is not getting into the table so I suspect my php script has an issue, but I can't find it. Below is the php script, I would be grateful for any help!
Magic quotes are disabled
PHP Version: 5.1.6
Display Errors: Off
Error Level: Not E_ALL
Register Globals: Off
Here is my issue:
I have a form on a webpage with a hidden input field, and a select field. I am using jquery to collect the data from those fields and post it to my php script which inserts it into the database. I'm pretty sure my javascript is working because I can use the print_r() command and it has the correct, updated data values from my fields everytime I test it, but the data is not getting into the table so I suspect my php script has an issue, but I can't find it. Below is the php script, I would be grateful for any help!
Code: Select all
<?php
session_start();
$rating = $_POST['rating'];
$pic_id = $_POST['pic_id'];
//Connect and select database
mysql_connect("192.168.000.000", "username", "password") or die(mysql_error());
mysql_select_db("tutorial") or die(mysql_error());
$query="INSERT INTO comments (pic_id, user, rating) VALUES ('".$pic_id."', '".$_SESSION['username']."', '".$rating."')";
mysql_query($query) or die(mysql_error());
?>