Insert query problem
I have a insert query that I have not changed, but for some reason it will not insert anything into the database.
The data gets inserted by a Ajax submit form and goes to insert.php
if(isset($_POST['message_wall'])){
/* Connection to Database */
include('config.php');
/* Remove HTML tag to prevent query injection */
$message = mysql_real_escape_string($_POST['message_wall']);
$to = mysql_real_escape_string($_POST['profile_to']);
$sql = 'INSERT INTO wall (message) VALUES(
"'.$message.'")';
mysql_query($sql);
I want to be able to add a user_id into the database too
The ajax code:
$(document).ready(function(){
$("form#submit_wall").submit(function() {
var message_wall = $('#message_wall').attr('value');
$.ajax({
type: "POST",
url: "insert.php",
data: "message_wall="+ message_wall,
success: function(){
$("ul#wall").prepend("<li style='display:none'>"+message_wall+"</li><br><hr>");
$("ul#wall li:first").fadeIn();
}
});
return false;
});
});
