PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 17th, 1999, 04:34 PM
hannnah
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
I have a double problem. I'm trying to set up a survey form, but a) I need to load data into more than 1 table in the database, and can't get that to work;

and b) some of the survey fields have to allow for multiple entries (series of checkboxes with "check all that apply"), and the only one that seems to be making it into the database is the last item selected.

PHP script code:

$query = "INSERT INTO programs VALUES('$program_name', '$program_district', '$program_address', '$program_city', '$program_state_prov', '$program_zip', '$program_phone', '$program_fax', '$program_email', '$program_url', '$contact_name', '$contact_title', '$contact_address', '$contact_city', '$contact_state_prov', '$contact_zip', '$contact_phone', '$contact_fax', '$contact_email', '$form_name', '$form_phone', '$form_email')";


$result = MYSQL_QUERY($query);

$query= "INSERT INTO info VALUES('$prog_descr_text', '$purpose')";

$result = MYSQL_QUERY($query);

--end code

Also, is $query some kind of reserved term? I've been able to insert into a single table using $query, but when I tried to differentiate between the 2 MYSQL_QUERY statements with different variables, that wouldn't work either.

Any help anyone can provide is greatly appreciated.

Thanks in advance!



Reply With Quote
  #2  
Old November 18th, 1999, 09:12 AM
rod k
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
There's no telling why your second query doesn't work unless you check the mysql error to see what mysql is complaining about. After the second query add this line:

print mysql_error();

As far as multiple selects go, you need to give the input an array variable name. e.g.:

name="myvar[]"

That way each selected item's value will be placed into the $myvar array starting at index 0.

Reply With Quote
  #3  
Old November 18th, 1999, 11:08 AM
hannnah
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Thanks! I've got stuff going into both tables now; my problem is still the checkboxes/arrays, but that's a question for the MySQL forum.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > double problem: loading data into multiple tables and forms processing

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap