Jump to content

[SOLVED] IF Statement Trouble


kyleldi

Recommended Posts

Though I thought I had this right, I've got two 'do' cmds in my statement to pull information from the db, yet I keep getting an error of an unexpected }.  The first do cmd is assembled the same way and it works just fine...

 

<?php
  if(isset($_GET['category'])){
echo "<div class='catdetail_header'><h1 class='style1'>".ucwords($row_rs_multi_dl['category'])."</h1></div>"; 
do {
echo '<div class="catdetail_header"><h1 class="style1">'.ucwords($row_rs_multi_dl['title']).'</h1></div>
<div class="catdetail_desc"><p>'.$row_rs_multi_dl['description'].'</p></div>
<div class="catdetail_footer"><a href="downloads/'.$row_rs_multi_dl['filetype'].'/'.$row_rs_multi_dl['filename'].'">Download Now</a></div>';
    } 
    while($row_rs_multi_dl = mysql_fetch_assoc($rs_multi_dl));
}
do {
echo '<div class="thumbframe">
<div class="thumb"><a href="downloads.php?category='.$row_rs_multi_cats['category'].'"><img src="images/downloads/'.$row_rs_multi_cats['category'].'.jpg" alt="'.$row_rs_multi_cats['category'].'" width="100" height="58" border="0" longdesc="downloads.php?category='.$row_rs_multi_cats['category'].'" /></a></div> 
<div>'.ucwords($row_rs_multi_cats['category']).'</div></div>';
   } 
   while ($row_rs_multi_cats = mysql_fetch_assoc($rs_multi_cats)); 
}
else{
echo "<div class='catdetail_header'><h1 class='style1'>Please Choose A Category</h1></div>"; 
do {
echo '<div class="catdetail_header"><h1 class="style1"><a href="downloads.php?category='.$row_rs_showcats['category'].'">'.ucwords($row_rs_showcats['category']).'</a></h1></div>';
}
while($row_rs_showcats = mysql_fetch_assoc($rs_showcats));
}
?>

Link to comment
https://forums.phpfreaks.com/topic/149145-solved-if-statement-trouble/
Share on other sites

Removing the bracket gives me an unexpected T_ELSE error on the line else{

 

<div>'.ucwords($row_rs_multi_cats['category']).'</div></div>';
   } 
   while ($row_rs_multi_cats = mysql_fetch_assoc($rs_multi_cats)); 
else{  //this line is what fails // 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.