mileslevi Posted March 25, 2009 Share Posted March 25, 2009 I have movies in a table each with an row id, title, description, rating, cover img url, and some other things but those are the main ones. I want php to display all the movies in a html table with the cover image to the left and title description so on to the right in "squares" 6 wide. Each "square" contains a different movie. The link to the movie is displayed in details.php?id=(id of movie). I would like them to be displayed alphabetically by title but not necessary. Quote Link to comment https://forums.phpfreaks.com/topic/151106-display-table-items/ Share on other sites More sharing options...
revraz Posted March 25, 2009 Share Posted March 25, 2009 Ok, and you need help with what? Post some code or the error you get. Quote Link to comment https://forums.phpfreaks.com/topic/151106-display-table-items/#findComment-793841 Share on other sites More sharing options...
mileslevi Posted March 25, 2009 Author Share Posted March 25, 2009 details.php gets the id of the movie and displays the info and cover in html: <?php $id = $_GET['id']; $link = mysql_connect("localhost", "user", "pass"); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db("movies") or die(mysql_error()) ; $result = mysql_query("SELECT * FROM data WHERE id='$id'"); while($row=mysql_fetch_object($result)){ $tit=$row->title; $yer=$row->year; $des=$row->description; $qua=$row->quality; $cvr=$row->cover; $loc=$row->file_loc; $oth=$row->other_info; } mysql_close($link); ?>... <table width="450" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="19%">Title:</td> <td width="81%"><?php echo $tit ?></td> </tr> <tr> <td>Year:</td> <td><?php echo $yer ?></td> </tr> ad so on.. </table> I need php to index all the movies in the sql table alphabetically and i want them to be displayed in an html table with a link to the detail page with the corresponding id to the movie (ie. movie 1 links to details.php?id=1) SEE DIAGRAM Quote Link to comment https://forums.phpfreaks.com/topic/151106-display-table-items/#findComment-793868 Share on other sites More sharing options...
mileslevi Posted March 25, 2009 Author Share Posted March 25, 2009 PS Mysql version: 5.0.51a PHP Version 5.2.8 Quote Link to comment https://forums.phpfreaks.com/topic/151106-display-table-items/#findComment-793897 Share on other sites More sharing options...
fenway Posted April 1, 2009 Share Posted April 1, 2009 an ORDER BY clause will make them alphabetical... the layout has nothing to do with mysql. Quote Link to comment https://forums.phpfreaks.com/topic/151106-display-table-items/#findComment-798550 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.