Ruko Posted April 19, 2010 Share Posted April 19, 2010 When I add games, I want them to be in rows. If there are over 15 rows, then there will be pages. I don't know how to do all that! Can someone give me examples or edit the file? New edit: [code=php:0] <?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']; } } ?> <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> <tr class="summaryTR summaryTR1"> <th><img src="<?=$imgsrc;?>"></img></th> <th><a href="ViewGame.php?gid=<?=$gid;?>"><?=$gametitle;?></a></th> <th><?=$gamerating;?></th> </tr> [/code] Link to comment https://forums.phpfreaks.com/topic/199019-let-the-sql-add-table-rows/ Share on other sites More sharing options...
aeroswat Posted April 19, 2010 Share Posted April 19, 2010 What you want is called pagination and there are a TON of tutorials on it out there. Pretty much what you will need to do is use a GET variable to determine what page you are on and set a LIMIT to what is being displayed in your query for each page. Do a quick google search on PHP pagination. Link to comment https://forums.phpfreaks.com/topic/199019-let-the-sql-add-table-rows/#findComment-1044645 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.