Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 542 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

Printing seats (theater) and printing taken ones as black seats

Thread title: Printing seats (theater) and printing taken ones as black seats
Reply    
    Thread tools Search this thread Display Modes  
12-03-2009, 09:26 PM
#1
.Cyanide is offline .Cyanide
Status: Senior Member
Join date: Mar 2006
Location: Stockholm,Sweden
Expertise: Web Design, Coding
Software: Phoshop CS3
 
Posts: 757
iTrader: 4 / 100%
 

.Cyanide is an unknown quantity at this point

Send a message via MSN to .Cyanide

  Old  Printing seats (theater) and printing taken ones as black seats

Hey again,

I'm back with a new problem that needs to be solved right NOW due to a very tight deadline (Monday).

I'm trying to print theater seats in rows of 5, where the seats that are already taken will be printed as black (i have an image for that). Now I can print properly the seats that have not yet been taken, but when i select one of the seats (they are checkboxes) that are on row 2 or 3, they seem to be forgotten by the script, because they are not printed as black seats. However - and I'm sorry if I'm losing you now - for some reason when I checked seats 1, 6 and 11, seat 1 and 6 showed up as black ones, but not seat 11.

Here's an example of what it looked like when I selected seats 1, 6 and 11:



I hope you've read the text above, if you did, then you'll understand that something's wrong with my script and that I want your help to fix it.


As you will se in the code i have three for's instead of just one, and that is because I used to have only one for-loop, but since that didn't work either I tried using three for-loops instead.

You may view the entire code here: http://pastebin.com/m1301265a

PHP Code:
<div id="stolar">
    <!-- Ladda in bild2 i bakgrunden (Image preloader) -->
    <div style="visibility: hidden; height: 0px; width: 0px;"><img src="stoloff.jpg" alt="" /></div>
    <?php
    
// Definiera sql för att kolla om stolen är upptagen
    
$sqlStolar "SELECT stolID FROM bokningar WHERE stolID < 6";
    
$resultStolar mysql_query($sqlStolar$connection) or die (mysql_error());
    
    
// Definiera sql för att kolla om stolen är upptagen
    
$sqlStolar2 "SELECT stolID FROM bokningar WHERE stolID > 5 AND stolID < 11";
    
$resultStolar2 mysql_query($sqlStolar2$connection) or die (mysql_error());
    
    
// Definiera sql för att kolla om stolen är upptagen
    
$sqlStolar3 "SELECT stolID FROM bokningar WHERE stolID > 10 AND stolID < 16";
    
$resultStolar3 mysql_query($sqlStolar3$connection) or die (mysql_error());
    
    
    
// Print seats, and black seats if seat's taken
    
for($i=1$i 6$i++) {
        
$minRad mysql_fetch_array($resultStolar);
        
        
// Print black seat if true
        
if($minRad['stolID'] == $i) {
            echo 
"<div class=\"disabledBox\">\n</div>\n";
        }
                
// Else; print red ones
        
else {
            echo 
"<div class=\"pimp_my_box\" id=\"pimp{$i}\" onclick=\"checkIt(this, 'demo{$i}')\">\n\t<input type=\"checkbox\" id=\"demo{$i}\" class=\"demo\" name=\"platser[]\" value=\"{$i}\" />\n</div>\n";
        }
    }
    for(
$k=6$k 11$k++) {
        
$raud mysql_fetch_array($resultStolar2);
        if(
$raud['stolID'] == $k) {
            echo 
"<div class=\"disabledBox\">\n</div>\n";
        }
        else {
            echo 
"<div class=\"pimp_my_box\" id=\"pimp{$k}\" onclick=\"checkIt(this, 'demo{$k}')\">\n\t<input type=\"checkbox\" id=\"demo{$k}\" class=\"demo\" name=\"platser[]\" value=\"{$k}\" />\n</div>\n";
        }
    }
    for(
$r=11$r 16$r++) {
        
$rawd mysql_fetch_array($resultStolar3);
        if(
$rawd['stolID'] == $i) {
            echo 
"<div class=\"disabledBox\">\n</div>\n";
        }
        else {
            echo 
"<div class=\"pimp_my_box\" id=\"pimp{$r}\" onclick=\"checkIt(this, 'demo{$r}')\">\n\t<input type=\"checkbox\" id=\"demo{$r}\" class=\"demo\" name=\"platser[]\" value=\"{$r}\" />\n</div>\n";
        }
    }
    
?>
    </div>
If there's something you don't understand, just ask!

Thank you!

Reply With Quote
Reply    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed