I'm having major problems uploading data to mySQL server, and have no clue how to go about it. I have searched up solutions and this is my current attempt:
function documentReady(){
$.ajax({
type: "POST",
url: "/phpServerContent.php",
data: {CollegeID: simData.userID, FirstName: "Bob", LastName: "Smith", ClassID: simData.userClassSelected},
cache: false,
success: function(html){
}
});
};
and this is my PHP:
<?php
mysql_connect("localhost","root");
mysql_select_db("userdatagravsim");
$result_set=mysql_query("SELECT*FROM users");
$num_messages=mysql_num_rows($result_set);
$CollegeID=$_POST["CollegeID"];
$FirstName=$_POST["FirstName"];
$LastName=$_POST["LastName"];
$ClassID=$_POST["ClassID"];
$query=mysql_query("INSERT INTO users(CollegeID,FirstName,LastName,ClassID)values('$name','$guessnum','$taskid','$effort')");
if($query){
echo "Your comment has been sent";
}
else{
echo "Error in sending your comment";
}
?>
I'm very new to programming, this is for A-level coursework. I am also unsure about how to view the echo flags to indicate if the upload has worked or not.
SELECT*FROM, let it breathe and put some spaces there. And where do you get your javascript variables from?