Jump to content

DarkSuperHero

Members
  • Posts

    342
  • Joined

  • Last visited

About DarkSuperHero

  • Birthday 02/03/1980

Contact Methods

  • AIM
    DarkSuperHero
  • Website URL
    http://www.HTMLandPHP.com

Profile Information

  • Gender
    Male
  • Location
    California

DarkSuperHero's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Your code is littered with extra empty else statements....try to make your code easier to read, it makes it easier for people to want to help.... Looks like you may have figured out your problem.... No changes to your original code other than cosmetic <?php $staffQuery = mysqli_query($staffConnected, "SELECT `name`, `email`, `department`, `position` FROM `staff` WHERE `class`=2 ORDER BY `department`, `name` ASC") if($staffQuery){ $rowNum=1; $cellNum=0; $amountOfStaffReturned=mysqli_num_rows($staffQuery); if($amountOfStaffReturned>0){ $departmentHeader=false; $content.='<div class="emailHeader">Staff Contacts</div>'; while($staff=mysqli_fetch_array($staffQuery, MYSQLI_ASSOC)) { $staffName=$staff['name']; $staffEmail=$staff['email']; $staffDepartment=$staff['department']; $staffPosition=$staff['position']; $rowName=rowName($rowNum); if($rowNum>1){ $rowEmailClassAdd=' emailRow'; } else { $rowEmailClassAdd=''; } if($cellNum%2==0){ if($departmentHeader!=$staffDepartment) { $content.='<div class="departmentHeader">'.$staffDepartment.'</div>'; $departmentHeader=$staffDepartment; } if($cellNum != 0){ $content.='</div>'; } $content.='<div class="overflowclear'.$rowEmailClassAdd.'" id="emailStaff'.ucfirst($rowName).'Row">'; $rowNum++; } $content .='<div class="emailCell"> <div class="emailTitle">'.$staffName.'</div> <div class="emailSubTitle">'.$staffPosition.'</div> <div><a class="contactemail" href="mailto:'.$staffEmail.'">'.escapeemail($staffEmail).'</a></div> </div>'; if($amountOfStaffReturned%2 != 0 && $cellNum+1 == $amountOfStaffReturned) { $content.='<div class="emailCell"> </div> </div>'; } $cellNum++; } //end while } }
  2. <?php $pizzaS['slice1']='meat'; $pizzaS['slice2']='meat'; $pizzaS['slice3']='meat'; $pizzaS['slice4']='veg'; $pizzaS['slice5']='veg'; $pizzaS['slice6']='veg'; $pizzaS['slice7']='veg'; $pizzaS['slice8']='meat'; foreach($pizzaS as $key=>$value){ if($value== "meat"){ // This line needed to have `meat` in quotes echo "I'll take that slice<br/>"; } else { echo "You can have that one<br/>"; } } //original snippet missing closing brace ?>
×
×
  • 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.