Hi On my website i want to show a list but i want to order it into different bits with heading. For example (bold is headings) Show1 Series1 ep1 ep2 Series2 ep1 ep2 In the table 'Episode' the field name for the show is 'program' and the name for the series is 'series' thanks -sbaldam1992 but the field program is shown as 1 2 or 3 as the way i added then episodes is by selecting from a drop down box. The table this links to is called 'Shows' and yes i have a field called ID to link to it. Using php how would i create this? If this is confusing tell me and i will try and explain it as my php and mysql knowledge is now that good. Thanks in advance -sbaldam1992
If I understood you correctly: To order by two field names, you use ORDER BY field1, field2 in the mySQL query
Hi yes i have already done this (see source below), but i would like to put it in headers (bold is headings) Show1 Series1 ep1 ep2 Series2 ep1 ep2 <?php $query = "SELECT * FROM Episode ORDER BY series ASC, episode ASC"; $query = mysql_query($query) or die(mysql_error()); while($a = mysql_fetch_assoc($query)){ echo "<a href=\"/watch.php?id={$a['id']}\">S{$a['series']}, E{$a['episode']} - {$a['name']}</a><br />"; } ?> PHP: So the result would be Doctor Who Series 1 Rose The end of the world Series 2 Tooth and Claw Torchwood Series 1 etc. Do you know what i mean?
All I can say is you need two loop statements but sorry i cant help you with the code. I'm still learning . Thanks, Cal.
Hi, Correct me if im wrong but from what i can gather you are trying to get them in order using a php query, however i dont think php will allow you to order a query by a none numeric charectar in other words to order it you need the row to be a number not letters. Hope this helps.
<?php $query = "SELECT * FROM Episode ORDER BY series ASC, episode ASC"; $query = mysql_query($query) or die(mysql_error()); while($a = mysql_fetch_assoc($query)){ echo "<a href=\"/watch.php?id={$a['id']}\">S{$a['series']}, E{$a['episode']} - {$a['name']}</a><br />"; } ?> PHP: No, using mysql. But all i want to do is put heading on saying the show name, then the series number, and have all the episodes from that show and that series to be in a list. Link to the php code above in action
It seems it won't let me edit my last post. but http://ws-fo.co.tv/episodes.php is the layout i want. If there is any way to do this automatically then good. Otherwise i will do it manually