Adding Data to MySQL Table using PHP(Revised) -


the code below using add tables created in database. i'm still receiving error query, error: have error in sql syntax; check manual corresponds mysql server version right syntax use near 'location, horseshoe) values('obed & isaacs','springfield illinois','buffalo chic' @ line 1.

how fix error? seems thing stopping rest of page load.

<?php $link=mysql_connect("*************","************","***********"); if (!$link) { echo "failed connect mysql: " . mysql_error(); } mysql_error(); mysql_select_db(horseshoevotes);   $sql = "insert `submissions` (restaurant, restaurant location, horseshoe) values('$_post[restaurant]','$_post[location]','$_post[horseshoe]','$_post[email]')";  if (!mysql_query($sql)) { die('error: ' . mysql_error($link)); } echo "submitted";  mysql_query($sql); mysql_close($link); ?> 

you haven't done database - you've put query variable.

add

mysql_query($sql) or die ("error! ".mysql_error()); 

before call mysql_close.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -