kyleldi Posted April 10, 2009 Share Posted April 10, 2009 I keep getting an error in my IF statement Parse error: syntax error, unexpected T_ISSET, expecting '(' The line its pertaining to is the second ISSET request, but I can't figure out what I did wrong. Any ideas? Here's my code: <?php if(isset($_GET['category'])){ echo '<h1><span class="red_upcap">C</span>ategories</h1>' ; do { echo '<div class="categories"><a href="store.php?category='.str_replace(" ","+",strtolower($row_rs_cats['category'])).'&sub='.str_replace(" ","+",strtolower($row_rs_cats['sub'])).'"><img src="store/thumbs/'.$row_rs_cats['img_t'].'" alt="'.ucwords($row_rs_cats['category']).'" width="'.$row_rs_cats['img_t_x'].'" height="'.$row_rs_cats['img_t_x'].'" border="0" longdesc="store.php?category='.str_replace(" ","+",strtolower($row_rs_cats['category'])).'&sub='.str_replace(" ","+",strtolower($row_rs_cats['sub'])).'" /></a><br /> <a href="store.php?category='.str_replace(" ","+",$row_rs_cats['category']).'">'.ucwords($row_rs_cats['category']).'</a></div>'; } while ($row_rs_cats = mysql_fetch_assoc($rs_cats)); } else if isset($_GET['sub'])){ /// Errors out here. echo '<h1><span class="red_upcap">C</span>ategory: '.ucwords($row_rs_subcategories['category']).'</h1>'; do { echo '<div class="categories"><a href="itemdetail.php?itemid='.$row_rs_subcategories['itemid'].'"><img src="store/thumbs/'.$row_rs_subcategories['img_t'].'" alt="'.ucwords($row_rs_subcategories['category']).'" width="'.$row_rs_subcategories['img_t_x'].'" height="'.$row_rs_subcategories['img_t_x'].'" border="0" longdesc="itemdetail.php?itemid='.$row_rs_subcategories['itemid'].'" /></a></div>'; } while ($row_rs_subcategories = mysql_fetch_assoc($rs_subcategories)); } else{ echo '<div class="categories"><a href="store.php?category='.str_replace(" ","+",$row_rs_categories['category']).'"><img src="store/thumbs/'.$row_rs_categories['img_t'].'" alt="'.ucwords($row_rs_categories['category']).'" width="'.$row_rs_categories['img_t_x'].'" height="'.$row_rs_categories['img_t_x'].'" border="0" longdesc="store.php?category='.str_replace(" ","+",$row_rs_categories['category']).'" /></a><br /> <a href="store.php?category='.str_replace(" ","+",$row_rs_categories['category']).'">'.ucwords($row_rs_categories['category']).'</a></div>' } while ($row_rs_categories = mysql_fetch_assoc($rs_categories)); } ?> Thank you so much! Quote Link to comment Share on other sites More sharing options...
Axeia Posted April 10, 2009 Share Posted April 10, 2009 you forgot the ( for the if statement. if isset($_GET['sub'])){ /// Errors out here. should be: if( isset($_GET['sub']) ){ /// Errors out here. Quote Link to comment Share on other sites More sharing options...
kyleldi Posted April 10, 2009 Author Share Posted April 10, 2009 Ok, it moves past the ISSET line, but fails on the last line before the end php block. echo '<div class="categories"><a href="store.php?category='.str_replace(" ","+",$row_rs_categories['category']).'"><img src="store/thumbs/'.$row_rs_categories['img_t'].'" alt="'.ucwords($row_rs_categories['category']).'" width="'.$row_rs_categories['img_t_x'].'" height="'.$row_rs_categories['img_t_x'].'" border="0" longdesc="store.php?category='.str_replace(" ","+",$row_rs_categories['category']).'" /></a><br /> <a href="store.php?category='.str_replace(" ","+",$row_rs_categories['category']).'">'.ucwords($row_rs_categories['category']).'</a></div>'; } while ($row_rs_categories = mysql_fetch_assoc($rs_categories)); } /// Error Here ?> The error is Parse error: syntax error, unexpected '}' Thank you again! Quote Link to comment Share on other sites More sharing options...
Maq Posted April 10, 2009 Share Posted April 10, 2009 Your while syntax is wrong, should look like this: while ($row_rs_categories = mysql_fetch_assoc($rs_categories)) { echo "no more error ". } /// Error Here Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.