Jump to content

[SOLVED] else if not working???


blueman378

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/89691-solved-else-if-not-working/
Share on other sites

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.