I am still learning PHP/mySQL but for the existence of me I can not determine wrong with my code. I am attempting to take several javascript variables from an html page and add these to a table during my database. I am using ajax and passing the variables within the URL, then locating all of them with $_GET. I have examined this and also the variables are passed properly towards the PHP script, however they are not appearing within the database. All I understand would be that the script dies about this line: mysql_query($query) or die('data entry failed') I made use of phpmyadmin to produce the table and my host is 000webhost. Thanks ahead of time!

$database='a9293297_blog';
$con=mysql_connect('mysql2.000webhost.com','my_username','my_password');
mysql_select_db($database,$con) or die('failed to connect to database');
$username=$_GET['username'];
$password=$_GET['password'];
$charName=$_GET['charName'];
$sex=$_GET['sex'];
$class=$_GET['class'];
$race=$_GET['race'];
$str=$_GET['str'];
$sta=$_GET['sta'];
$dex=$_GET['dex'];
$int=$_GET['int'];
$cha=$_GET['cha'];
$query="INSERT INTO Players (username, password, charName, sex, class, race, str, sta, dex, int, cha)
VALUES ('".$username."', '".$password."', '".$charName."', '".$sex."', '".$class."', '".$race."', '".$str."', '".$sta."', '".$dex."', '".$int."', '".$cha."')";
mysql_query($query) or die('data entry failed');
mysql_close($con);

To understand better wrong together with your SQL query, use mysql_error():

mysql_query($query) or die(mysql_error());

Escape your string variables with mysql_real_escape_string(). Example:

$query = "INSERT INTO MYTABLE(MYFIELD) VALUES ('".mysql_real_escape_string($myVar)."');

EDIT

int appears to become a reserved MySQL keyword. Escape it with backquotes:

INSERT INTO Players (username, password, ..., str, sta, dex, `int`, cha) ...

i am not sure but do this

Your Code

$query="INSERT INTO Players (username, password, charName, sex, class, race, str, sta, dex, int, cha)VALUES ('".$username."', '".$password."', '".$charName."', '".$sex."', '".$class."', '".$race."', '".$str."', '".$sta."', '".$dex."', '".$int."', '".$cha."')";

Within this code

$query="INSERT INTO Players (username, password, charName, sex, class, race, str, sta, dex, int, cha)VALUES ('$username', '$password', '$charName', '$sex', '$class', '$race', '$str', '$sta', '$dex', '$int', '$cha')";

Maybe this can help should you remove " and .