Jump to content

[SOLVED] INSERT INTO problem?


burtybob

Recommended Posts

$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?

Link to comment
https://forums.phpfreaks.com/topic/75081-solved-insert-into-problem/
Share on other sites

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.