burtybob Posted October 28, 2007 Share Posted October 28, 2007 $question=$_REQUEST['question']; $title=$_REQUEST['title']; $a1=$_REQUEST['answer1']; $a2=$_REQUEST['answer2']; $a3=$_REQUEST['answer3']; $a4=$_REQUEST['answer4']; $a5=$_REQUEST['answer5']; $sql=mysql_query("INSERT INTO polls (`title`,`question`,`answer1`,`answer2`,`answer3`,`answer4`,`answer5`,`dt`) VALUES ('$title','$question','$a1','$a2','$a3','$a4','$a5',NOW()"); if ($sql){ //everything between here $message="New Poll Added"; } else { $message="A problem in adding new poll"; } // and here is just for general information and conformation to the //staff so we know if poll was added or not Ok this is the code i have and it keeps showing the A problem in adding new poll Yet i cannot see why please can somone help me? Quote Link to comment https://forums.phpfreaks.com/topic/75081-solved-insert-into-problem/ Share on other sites More sharing options...
LemonInflux Posted October 28, 2007 Share Posted October 28, 2007 I will look in a sec. Just a quick question; do you have access to phpmyadmin? If so, use the 'insert' feature on there to enter some test data, then press 'create PHP code', and that'll give you a code that works. If not, I'll get back to you in a sec. Quote Link to comment https://forums.phpfreaks.com/topic/75081-solved-insert-into-problem/#findComment-379735 Share on other sites More sharing options...
LemonInflux Posted October 28, 2007 Share Posted October 28, 2007 Can you do me a favour? Change it to this: $question=$_REQUEST['question']; $title=$_REQUEST['title']; $a1=$_REQUEST['answer1']; $a2=$_REQUEST['answer2']; $a3=$_REQUEST['answer3']; $a4=$_REQUEST['answer4']; $a5=$_REQUEST['answer5']; $sql=mysql_query("INSERT INTO polls (`title`,`question`,`answer1`,`answer2`,`answer3`,`answer4`,`answer5`,`dt`) VALUES ('$title','$question','$a1','$a2','$a3','$a4','$a5',NOW()") or die(mysql_error()); and tell me what it says. Quote Link to comment https://forums.phpfreaks.com/topic/75081-solved-insert-into-problem/#findComment-379736 Share on other sites More sharing options...
burtybob Posted October 28, 2007 Author Share Posted October 28, 2007 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 '' at line 1 Ok so i now have some idea of what/where the problem is. Quote Link to comment https://forums.phpfreaks.com/topic/75081-solved-insert-into-problem/#findComment-379789 Share on other sites More sharing options...
burtybob Posted October 28, 2007 Author Share Posted October 28, 2007 Ok i have sorted it now thank you i was missing a single ) Quote Link to comment https://forums.phpfreaks.com/topic/75081-solved-insert-into-problem/#findComment-379791 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.