$posted needs to have '' around it!!  <-- this could be stopping it!!

(and always check to see if the vars exist first and if you are using
4.1 + with globals off you will need to change you code now or in the
future)


Timothy Hitchens (HiTCHO)
Open Platform Consulting
e-mail: [EMAIL PROTECTED]

> -----Original Message-----
> From: - [ Paul Ferrie ] - [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, 9 January 2003 10:07 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] $query help :(
> 
> 
> Hi again guys i have run into another problem :(
> 
> i am trying to build a user poll (flash+php+mysql)
> I have the interface all sorted but i have a problem with my 
> add new poll php file. When i hit the update poll button in 
> flash it seem that everthing has work and it' send back a msg 
> saying all went well :).  but when i check with phpmyadmin i 
> see that the $query has been successfully added but the 
> "question","opt1","opt2","opt3" fields are blank no data 
> added. the only fields to be added were the auto_id and date 
> stamp below is a sample code of the php file and after that 
> you will see the code on the button.
> 
> [php]
> if ($action == "add") {
>     // Include config file
>     include('common.php');
> 
>     // Connect to database
>     $link = dbConnect();
> 
>     // Get date for new poll
>     $posted = time();
> 
>     // Build query to insert new poll
>     $query = "INSERT INTO polls (question, option1, option2, option3,
> posted) VALUES ('$quest1', '$opt1', '$opt2', '$opt3', $posted)";
> 
>     // Execute query
>     $result = @mysql_query($query);
> 
>     // If query failed...
>     if (!$result) {
>         // Display error
>         print "&result=Could not insert poll";
>     } else {
>         print "&result=poll created";
>     }
> 
>     mysql_close($link);
> }
> ?>
> [/php]
> 
> on the button in Flash i have
> [code]
> on (release) {
>  if (!quest1.length) {
>   result = "fields missing";
>  }
>  if (!opt1.length) {
>   result = "fields missing";
>  }
>  if (!opt2.length) {
>   result = "fields misasing";
>  }
>  if (!opt3.length) {
>   result = "fields missing";
>  } else {
>   loadVariables("addpoll.php", this, "POST");
>   gotoAndPlay(2);
>  }
> }
> 
> [/code]
> 
> I have tried everything i can think of but i cab't seem to 
> get it working. Can anyone see anything i am missing? Cheers
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to