Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 03-04-2005, 01:46 PM Array Problem
Super Talker

Posts: 121
Trades: 0
I am creating a gig and band booking system and i need some help.

There are three tables bands, gigs and bandgig, the bands table holds information about the band. The gig table holds information about the gig and bandgig holds information about what bands are playing at what gigs. It uses the gig id and the band id to assign bands to gigs, it also has the position of the band in the line up, 1 through 6, 1 being the headlining band.

When a new gog is added the bands are chosen form dropdown lists, this is not a problem, but when i go to edit the gig i need the band that is playing to be selected in the drop down list. But it also has to be in the right drop down list, my idea was to have an array that held the band ID, name, and position and then use a foreach llop and an if statement, how can i create that array though?

any ideas, or any ideas on how is best to solve this problem?
vegancoder is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-04-2005, 02:17 PM
Phaedrus's Avatar
Ultra Talker

Posts: 271
Location: CA
Trades: 0
Creating an array is easy in PHP, the mysql_fetch_array() function gets an array from database results. the foreach() loop is made specifically to loop through arrays. There are also a bazillion other ways of manipulating arrays. I don't quite understand from your post exactly what it is you're trying to do, some code or something would help me give a more detailed response.
__________________

Please login or register to view this content. Registration is FREE
Phaedrus is offline
Reply With Quote
View Public Profile
 
Old 03-05-2005, 06:50 AM
Super Talker

Posts: 121
Trades: 0
hmmmm its kinda hard to explain clearly, i used mysql_fetch_array() to get it but it only seems to get the one record, and if you use while($r = mysql_fetch_array($sql)){ you can only do it once with one query and i dont really wanto perform anothe query
vegancoder is offline
Reply With Quote
View Public Profile
 
Old 03-05-2005, 11:18 AM
Phaedrus's Avatar
Ultra Talker

Posts: 271
Location: CA
Trades: 0
Quote:
Originally Posted by vegancoder
and if you use while($r = mysql_fetch_array($sql)){ you can only do it once with one query and i dont really wanto perform anothe query
Actually you can loop through the results as many times as you want, you just need to reset the pointer:
PHP Code:
mysql_data_seek($r0); 
__________________

Please login or register to view this content. Registration is FREE
Phaedrus is offline
Reply With Quote
View Public Profile
 
Old 03-05-2005, 10:17 PM
Super Talker

Posts: 121
Trades: 0
sweet, didnt know about that, thank you thats going to change loads now he he
vegancoder is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Array Problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.42325 seconds with 12 queries