Jump to content


Database -- sorting by series

  • Please log in to reply
1 reply to this topic

#1 Coronet

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 30 May 2006 - 07:56 PM

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".


//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)) {

$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> 




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]

#2 jworisek

  • Members
  • PipPipPip
  • Advanced Member
  • 112 posts

Posted 30 May 2006 - 08:14 PM

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...

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]'";

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users