Reputation: 9388
I have a php script that is being called by an ajax post. I am getting the error
Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\Escape\SendTestimony.php on line 9
Here is the paramaters
$name = $_POST['name'];
$message = $_POST['message'];
Here is line 9 where the error occurs. Thanks for any help.
mysql_query("CALL sp_CreateTestimony("$name.", "$message.")");
EDIT ADDED JQUERY AJAX CALL
var parameters = {
'name': $('#cf_name').val(),
'message': $('#cf_message').val()
}; //Use JSON to pass parameters into ajax calls
parameters = JSON.stringify(parameters);
//Make ajax call to post to database
$.ajax({
type: 'POST',
url: '../Escape/SendTestimony.php',
datatype: 'json',
data: parameters,
success: function (result) {
alert(result);
$('#ValidateTest').html('Thank-you!').css({ 'color': 'green' }).show();
},
error: function(jqXHR, textStatus, errorThrown) {alert(textStatus + ":" + errorThrown);}
});
Upvotes: 1
Views: 1842
Reputation: 3843
you should add dots before variables and single quotes around them:
mysql_query("CALL sp_CreateTestimony('".$name."', '".$message."')");
Upvotes: 3
Reputation: 9388
stringify was the problem. I removed that and it fix the problem.
Upvotes: 0