RE: [PHP] $query help :(
| From: | Timothy Hitchens \(HiTCHO\) | Date: | Thu, 09 Jan 2003 00:13:10 +0000 |
| Subject: | RE: [PHP] $query help :( | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-130831@lists.php.net to get a copy of this message | ||
$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: tim@hitcho.com.au
> -----Original Message-----
> From: - [ Paul Ferrie ] - [mailto:info@innovativedesigns.org.uk]
> Sent: Thursday, 9 January 2003 10:07 AM
> To: php-general@lists.php.net
> 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
>