mysqli - inserting variables into MySQL -


i trying insert 2 scores mysql 2 photos particular user exists in database. scores , photos both post variables form. having great difficulty syntax - error related position of quotes despite searching here , finding similar questions can't seem working. loathed bother people need executive assistance.

$imaget=$_post[randomimage]."t" ; $imageh=$_post[randomimage]."h" ; $observerid=$_post[scoreid]; $traction=$_post[gradet]; $honeycomb=$_post[gradeh];   $sql="insert scorers ('$imaget', '$imageh')     values ('$imaget', '$imageh') id=$observerid ";         if (!mysqli_query($con,$sql)) {             die('error: ' . mysqli_error($con));         } else {             header("location: testform.php");         }                                          ' 

$imaget , $imageh both integers either t or h appended them, example 12t or 14h therefore assumed treated strings , put quotes around them. $traction, $honeycomb , $observerid integers. when echo $imaget, $imageh, $traction, $honeycomb , $observerid correct values shown assuming there no error in these, way placing them within sql code.

very appreciate (been learning php , sql 4 weeks apologies).

at least 3 main problems @ glance

  1. you aren't using prepared statements
  2. you using clause in insert statement useless , erroneous. either remove part or change query update.
  3. you didn't post error question. have to. error messages cornerstone of troubleshooting.

Comments