Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.