I'm currently having a slight problem with a query for this site: http://www.tdrdesign.net/dc2/index.php
What i'm trying to do is on the left side, where the listed comics are. At present, I have them listed in order by selecting the 'id' of the first 11 entries in the database and putting them in ascending order whilst limiting it to show only the first 11 (Action Comics #1 is 1, Wonder Woman #0 is 11). After the listing for each, I want to have it so that the latest issue of the same title is listed and that clicking on the link, it will go to the latest issue. But I can't seem to do this because it will only list the issue number of the first 11 entries from the database. So say, instead of Action Comics #2 appearing, it will still be #1.
The code for this is below:
<?php
mysql_connect ('#####' , '#####' , '#####');
mysql_select_db ('dc2db');
$results = mysql_query ("SELECT * FROM continuity ORDER BY c_id ASC LIMIT 11");
if( $results ) {
while( $contact = mysql_fetch_object( $results ) )
{
// print out the info
$id = $contact -> c_id;
$name = $contact -> c_name;
$issue = $contact -> c_issue;
$coverimage = $contact -> c_coverimage;
$coverimagetn = $contact -> c_coverimagetn;
$writer = $contact -> c_writer;
$artist = $contact -> c_artist;
$description = $contact -> c_description;
print ("<li><a href=\"comic.php?name=".$name."&issue=".$issue."\">".$name." (".$issue.")</a></li>"."\n");
}
} else {
die( "Trouble getting contacts from database: " . mysql_error() );
}
mysql_close ();
?>
I've tried so that the listing will be in order by name, but then it just adds Action Comics #2 right below #1. And i've tried listing by issue, but then it does them all so that any with issues numbered 0 will be first.
I hope i'm explaining this clearly, because i'm confusing myself a bit right now. Can anybody help with this? :bemused: