Php and Html table problems

Umbreon

Paragon
Joined
Jul 22, 2009
Messages
1,551
Reaction score
2
FP$
1,032
Can someone fix this part of the code. All the game links and stuff won't display.
Code:
      <h4>Browsing Game Category, <?=$category;?></h4>
          <table id="summaryTbl">
            <col id="Location" width="100"> 
            <col id="Offer" width="350"> 
            <col id="Points">
              <tr id="gametr1"> 
                  <th id="gameth">Thumbnail</th> 
                  <th id="gameth">Title</th> 
                  <th id="gameth">Game Rating</th> 
                  </tr> <?
  if($num_rows == 0)
         {
           echo "That was not a valid category.";
           // You can make the above line whatever you wish, it just tells people that no games with that category were found
         }
        else
         {
           while($row = mysql_fetch_array($result))
            {
             // generates a link to each game in this category and inserts a line break each time
             
              echo "<tr class="gametr gametr2">" 
		<th><img src="<?=$imgsrc;?>"></img></th>
                <th><a href="ViewGame.php?gid=<?=$gid;?>"><?=$gametitle;?></a></th>				
		<th><?=$gamerating;?></th>			
				  </tr><?
            }
         }
         ?>
 
I'm not sure if you initiate the database connections before this part because I don't see it here, but I've added it.

Code:
          <h4>Browsing Game Category, <?php echo $category; ?></h4>
              <table id="summaryTbl">
                <col id="Location" width="100">
                <col id="Offer" width="350">
                <col id="Points">
                  <tr id="gametr1">
                      <th id="gameth">Thumbnail</th>
                      <th id="gameth">Title</th>
                      <th id="gameth">Game Rating</th>
                      </tr> <?php

        require_once('mysql.php');
        mysql_select_db("ruko_fp", $con);

        $thispage = $_SERVER["REQUEST_URI"];
        $category = strstr("$thispage","=");
        $category = substr($category, 1);

        $result = mysql_query("SELECT * FROM games WHERE category LIKE '%$category%'");
        $num_rows = mysql_num_rows($result);

        if($num_rows == 0)
             {
               echo "That was not a valid category.";
               // You can make the above line whatever you wish, it just tells people that no games with that category were found
             }
            else
             {
               while($row = mysql_fetch_array($result))
                {
                 // generates a link to each game in this category and inserts a line break each time
                  echo "<tr class=\"gametr gametr2\"><th><img src=\"".$row['imgsrc']."\"></img></th>";
                  echo "<th><a href=\"viewgame.php?gid="$row['gid']"\">".$row['gametitle']."</a></th>";
                  echo "<th>".$row['gamerating']."></th></tr>";
                }
             }
             ?>

That should work, if not let me know - I only had one cup of coffee today :lol:
 
Oh, the whole code is:
Code:
<?php
        require_once('mysql.php');
        mysql_select_db("ruko_fp", $con);

        $thispage = $_SERVER["REQUEST_URI"];
        $category = strstr("$thispage","=");
        $category = substr($category, 1);

        $result = mysql_query("SELECT * FROM games WHERE category LIKE '%$category%'");
        $num_rows = mysql_num_rows($result);
        if($num_rows == 0)
         {
           echo "That was not a valid category.";
           // You can make the above line whatever you wish, it just tells people that no games with that category were found
         }
        else
         {
           while($row = mysql_fetch_array($result))
            {
         $flashlink = $row['gameswf'];
         $gid = $row['gid'];   
         $gametitle = $row['gametitle'];
         $gamedescription = $row['gamedescription'];
         $gamerating = $row['gamerating'];
         $gamereview = $row['gamereview'];
         $imgsrc = $row['imgsrc'];
            }
          }
/* This section is for Pargation!!
<!--------------------------------------------------------->
<!--------------------------------------------------------->
<!--------------------------------------------------------->
<!--------------------------------------------------------->
<!--------------------------------------------------------->
The block is used so it can be easier for me to edit this part of the code
if nessisary */
?>
        <head>
   <title>Browsing Category, <?=$category;?></title>
    <meta name="description" content="Browsing Category, <?=$category;?>" />
    <meta name="keywords" content="Game, Fun, Flash" />
    <meta name="author" content="Luigi R." />
    <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
	<link rel="icon" type="image/png" href="images/favico.png" />	
	<link rel="stylesheet" href="style.css"  type="text/css" media="screen" />
        </head>
<div class ="wrap">
	    <? include('announcements.html') ?>
	    <? include('logo.html') ?>
	    <? include('categories.html') ?>
  <div id='conTOP'>
    <div id='content'>
      <h4>Browsing Game Category, <?=$category;?></h4>
          <table id="summaryTbl">
            <col id="Location" width="100"> 
            <col id="Offer" width="350"> 
            <col id="Points">
              <tr id="gametr1"> 
                  <th id="gameth">Thumbnail</th> 
                  <th id="gameth">Title</th> 
                  <th id="gameth">Game Rating</th> 
                  </tr> <?php

        require_once('mysql.php');
        mysql_select_db("ruko_fp", $con);

        $thispage = $_SERVER["REQUEST_URI"];
        $category = strstr("$thispage","=");
        $category = substr($category, 1);

        $result = mysql_query("SELECT * FROM games WHERE category LIKE '%$category%'");
        $num_rows = mysql_num_rows($result);

        if($num_rows == 0)
             {
               echo "That was not a valid category.";
               // You can make the above line whatever you wish, it just tells people that no games with that category were found
             }
            else
             {
               while($row = mysql_fetch_array($result))
                {
                 // generates a link to each game in this category and inserts a line break each time
                  echo "<tr class=\"gametr gametr2\"><th><img src=\"".$row['imgsrc']."\"></img></th>";
                  echo "<th><a href=\"viewgame.php?gid="$row['gid'];"\">".$row['gametitle']."</a></th>";
                  echo "<th>".$row['gamerating']."></th></tr>";
                }
             }
             ?>

I just had a cup of coffee and I can't stop shaking and thinking about the success of my site :lol:
 
Before I do this, can you try recoding it with the new template I made for you, so I know where you want everything.
 
Oh, this is supposed to be marked as solved. It was fixed by another member at sitefrost.
 
Back
Top Bottom