I have this code to insert into a DB. And for some reason it is breaking on the 3rd parameter. If i take it out the other 2 work just fine.
Also i know it should be mysqli, im working with old code and just trying to get this part working. Will address updating later.
echo $_SESSION['test']['categoryname'];
$result = mysql_query('INSERT INTO '.$db_table_prefix.'saved_tests (user, category, categoryname) VALUES ('. $user["id"] .','. $_SESSION["test"]["category"] .','. $_SESSION["test"]["categoryname"] .')', $db_connection);
this outputs on the page:
Airway Respiration and Ventilation
failed to insert data1064: 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 'Respiration and Ventilation)' at line 1
I cant seem to figure out what the issue is. you can see printing the variable displays the full string.