Jump to content

Recommended Posts

Please take a look at my code. Its fairly simple. If a certain variable in my database is "0" it sets all the divs in the table to a certain color, if it is "1", it sets it to another.

 


<?php
include "page.class";

$Sample = new Page;

$Content = "
<HTML>
<BODY>

</BODY>
</HTML>";

$Sample->Title = "Welcome To The Royal Regal Theatre!";
$Sample->Keywords = "PHP, Classes";
$Sample->SetContent( $Content );

$Sample->Display( );

?>  
<a href="book1.php"><font color="#b9c059"><b>Back To List Of Shows</b></a></font>
<font color="#939b1e"><h2>Russel Watson</h2></font>

<?php  
   
mysql_connect("localhost", "0607197", "12345") or die("Can't connect to database server!");
mysql_select_db("db0607197") or die(" Can't select database!");

    $updated = FALSE;  
    if(count($_POST) > 0){  
        $admin = $_POST['admin'];  
        array_map('intval',$admin);  
        $admin = implode(',',$admin);  
       
        mysql_query("UPDATE seats SET show2=1 WHERE id IN ($admin)") or trigger_error(mysql_error(),E_USER_ERROR);  
	mysql_query("UPDATE seats SET usernameshow2='$username' WHERE id IN ($admin)") or trigger_error(mysql_error(),E_USER_ERROR);  
	 echo 'Congratulations <b><font color="#b9c059"><font size="11px">	'.$username.' </b></font></font>You Have Succesfully Booked The Seat/s'."\n"; ;
       $updated=TRUE;  
   }  
   ?>  


   <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">  
   <?php  
    
   ?>  
   
  
  

  
   <?php  
$booked = "<b>Seat Booked</b>";
   
   $sql = "SELECT id,usernameshow2,show2,rowId,columnId FROM seats ORDER by id ASC";  

   $result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR); 


   while(list($id,$username,$admin,$columnId,$rowId)=mysql_fetch_row($result)){
   


    


if($admin==1){ 
      



       

echo '<div style=" background-color: #ff0000;margin: 2px;padding-top: 5px;width: 58px;height: 49px;float: left;"><b><font color="black">'.$rowId.''.$columnId.'</div>'."\n";    


   
   }

if($admin==0){  


       $checked = ($admin==1) ? 'checked="checked"' : ''; 
    
      echo '<div style=" background-color: #008800;margin: 2px;padding-top: 5px; width: 58px;height: 49px;float: left;"><b><font color="black">'.$rowId.''.$columnId.'<input type="checkbox" name="admin[]" value="'.$id.'"  /></div>'."\n";  
   
   
}



}


   ?>  
   <p><div style="float:bottom;text-align:center;paddin-top:40px;"><input type="submit" name="submit" value="Book Seat" /> </div>

   </form>  
   
   </div>
   </div>
   
   
   

 

I want it to be different so that the top two rows are say purple, next three green, next two orange etc.

 

And still make all seats red if they have been booked.

 

I have tried something like :

 

if($rowId=="uCF"){  


       $checked = ($admin==1) ? 'checked="checked"' : ''; 
    
      echo '<div style=" background-color: #FF9874;margin: 2px;padding-top: 5px; width: 58px;height: 49px;float: left;"><b><font color="black">'.$rowId.''.$columnId.'<input type="checkbox" name="admin[]" value="'.$id.'"  /></div>'."\n";  
   
   
}

 

I am obviously placing this in the wrong place or using the wrong code?

 

Please any help you can give would be very much appreciated.

 

Dan

Link to comment
https://forums.phpfreaks.com/topic/152553-booking-system-help-just-layout-based/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.