I have sent queries to mysql databases a lot so it threw me for a loop when this stopped working. I'm just trying to insert text and int and decimal information. Is the syntax wrong somewhere? It throws this error message, but I dont know what it means!
Errormessage:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'long) VALUES (jpeg.jpg,1410700,image/jpeg,1372713379,42.978852222222,-86.0356041' at line 1
name, type, datetime table columns are varchar
size is int
lat and long are decimals(14,12) and (15,12)
I have tried many different variations of the query to try and send it to my localhost wampserver. If you see something I missed please let me know. Thanks!
$conn = mysqli_connect("localhost", "root", "password", "databaseimage") or die('Error Connecting.');
$sql = "INSERT INTO `images` (name,size,type,datetime,lat,long) VALUES ($imageName,$imageSize,$imageType,$datetime,$lat,$long)";
if(mysqli_query($conn, $sql)) {
echo "Added to database successfully!";
} else {
echo "Error sending query!";
printf("\nErrormessage: %s\n", mysqli_error($conn));
}
I have tried it with and without `` marks. I have tried it with single quotes around each variable. I have tried just sending raw data through and it still errors out.
long