Coronet Posted May 30, 2006 Share Posted May 30, 2006 This has probably been asked a number of times, but I am attempting to create a database with PHP to organize my layouts (I run a free template site) and I'm rather new to PHP. I have already created the tables in PHPmyadmin and named my table "layouts".[code]<?PHP//My connection stuff here.$query = "SELECT DISTINCT series FROM layouts order by series asc ";$result= mysql_query($query, $connection) or die("Could not execute query : $q." . mysql_error());while ($row=mysql_fetch_array($result)) {$series=$row["series"];$q = mysql_query("select * from `layouts` where `series`='$series'");$numrows = mysql_num_rows($q);echo " <a href='series.php?series=$series'>$series</a> [<b>$numrows</b>] <br> ";}?> [/code]I get an error that it DOES list the series, but when I click on a link, it doesn't show the layouts in that category. It just sits on the page and doesn't process anything. >_<; I'm sure this is something stupid I'm doing, but any help for my nubness would be much appreciated.Here's a link to the page that I have for testing purposes.[a href=\"http://second-eden.net/testing/final/series.php\" target=\"_blank\"]http://second-eden.net/testing/final/series.php[/a] Quote Link to comment https://forums.phpfreaks.com/topic/10794-database-sorting-by-series/ Share on other sites More sharing options...
jworisek Posted May 30, 2006 Share Posted May 30, 2006 that page does exactly what you programmed it to... nowhere in your programming is a call to check inside the given 'series'.You should put code for checking the series hits inside an if...[code]if ($_GET[series]!=""){ /* Note you should actually test what is given against actual values to verify that a user didn't make up a series to gain access to your query.... */ $sql= select ..... from layouts where series='$_GET[series]'";...etc}else{}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10794-database-sorting-by-series/#findComment-40366 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.