blueman378 Posted February 6, 2008 Share Posted February 6, 2008 Hi guys i have this code... <?php global $database; $q = "SELECT cName FROM " . gsubcat . " ORDER BY `cName` ASC "; $result = $database->query($q) or die("Error: " . mysql_error()); /* Error occurred, return given name by default */ $num_rows = mysql_numrows($result); while( $row = mysql_fetch_assoc($result) ) { $cat1 = $row[cName]; $cat2 = $row[cName]; if ($cat1 == "Action / Adventure") { $cat2 = "Action"; } elseif ($cat1 == "Shoot em up") { $cat2 = "Shoot"; } elseif ($cat1 == "Beat em up") { $cat2 == "Beat"; } else { $cat2 = $cat1; } ?> <div class="cntttl"> <div class="cntbox"> <div class="cntbox_head"><div><table cellspacing="0" width="100%"> <tbody><tr> <td><h1><?php echo $row[cName]; ?> Games</h1></td> <td class="blockheaderlink"> <a linkindex="72" href="catcontents.php?cat=<?php echo $row[cName]; ?>">More <?php echo $row[cName]; ?> Games <img src="images/more.png" align="absmiddle"></a> </td> </tr> </tbody></table></div></div> <div class="cntbox_cnt"><?php include("scripts/$cat2.php"); ?></div> <div class="cntbox_foot"><div><div></div></div></div> </div> </div> <?php } ?> which works perfectly except for one thing, the Beat em up elseif statment is having no effect, the action adventure one and shoot em up are but the beat em up is not i should get Beat.php but instead im getting Beat em up.php, |ay ideas? Quote Link to comment https://forums.phpfreaks.com/topic/89691-solved-else-if-not-working/ Share on other sites More sharing options...
PHP Monkeh Posted February 6, 2008 Share Posted February 6, 2008 Change { $cat2 == "Beat"; } to { $cat2 = "Beat"; } Quote Link to comment https://forums.phpfreaks.com/topic/89691-solved-else-if-not-working/#findComment-459619 Share on other sites More sharing options...
blueman378 Posted February 8, 2008 Author Share Posted February 8, 2008 true true... stupid me lol thanks Quote Link to comment https://forums.phpfreaks.com/topic/89691-solved-else-if-not-working/#findComment-461544 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.