Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
I know there has to be a shorter way of doing this than what I've come up with.

I am creating a score entry form for a fantasy league for drum corps. Corps are given scores on different aspects (captions) of their show which are calculated together to get a final score.

I am trying to create a form where someone can enter the names of the competing corps at a certain competition along with all of their caption scores, which are then written to the database. Here is an example of what I have come up with so far...
[]http://www.drumlines.org/upload/captions.gif[/]

I have created a table for each corps that contains the captions scores and a competition id for the primary. I want to be able to enter all of the corps' scores on the same form to submit it and have everything be written to each corps' respective database. To accomplish having two entries I have appended "2" to the end of the variables and created a second query.

There has to be an easier way to do this. Does anyone out there understand my ramblings?

This should give you an idea of how I'm doing it...
Code
 <br />// ------------------------------------------- <br />// Add the competition results to the database <br />   $query = " <br />	INSERT INTO fdc_$corps (comp_id,gemus,gevis,musbras,musperc,musens,visperf,visguard,visens,penalty,finalscore) <br />	VALUES ('$competition','$gemus','$gevis','$musbras','$musperc','$musens','$visperf','$visguard','$visens','$penalty','$finalscore') <br />   "; <br />   $dbh -> do_query($query); <br /> <br />   $query = " <br />	INSERT INTO fdc_$corps2 (comp_id,gemus,gevis,musbras,musperc,musens,visperf,visguard,visens,penalty,finalscore) <br />	VALUES ('$competition','$gemus2','$gevis2','$musbras2','$musperc2','$musens2','$visperf2','$visguard2','$visens2','$penalty2','$finalscore2') <br />   "; <br />   $dbh -> do_query($query); <br />

Last edited by DLWebmaestro; 05/19/2004 4:30 PM.
Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Unfortunately, you can only update one table at a time. You can read from multiple tables with a join, but I'm not aware of a way to update two different database tables at once.

Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609


Thanks for clarifying.


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)