Jump to content

Display Table Items


mileslevi

Recommended Posts

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.

Link to comment
Share on other sites

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

 

diagram.jpg

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.