Hi can someone help me in adding a page id to the database in this php comment system tutorial tutorial: http://tutorialzine.com/2010/06/simple-ajax-commenting-system/ I have added a extra field in the database table called "page_id" on the demo.php page i have added: $id=$_GET['id']; PHP: and also included a extra hidden field: <label for="page_id"></label> <input type="text" id="page_id" name="page_id" value="<?php echo $id;?>" /> PHP: and then in the submit.php file my insert looks like mysql_query(" INSERT INTO comments(name,url,email,body,page_id) VALUES ( '".$arr['name']."', '".$arr['url']."', '".$arr['email']."', '".$arr['body']."',' '".$arr['page_id']."',' )"); $arr['dt'] = date('r',time()); $arr['id'] = mysql_insert_id(); PHP: for some reason its not working, if someone can help it will be much appreciated! Thanks!
replace $arr['page_id'] with $id? Also make sure $id=$_GET['id']; is validated appropiately from SQL injections; mysql_real_escape_string and is_numeric(); (assuming the value is a number)
Add or die(mysql_error()); after mysql_query(), should output wheres the problem, if the problem is in your query