Jump to content

Display all of a table as a table.


MadnessRed

Recommended Posts

I want a table with a lot of rows, one for each line of the database.

 

here is what I have that would display the first line

 

// Lets select the table
$tblsites = $prefix.'sites';
$id = 1;

$result = mysql_query("SELECT * FROM '$tblsites' WHERE ID='$id'");

while($row = mysql_fetch_array('$result'))
  {
  $ratecalc = ($row['Rating'] / $row['Ratings']);
  $rateround = round($ratecalc, 2);
  echo '<tr>';
  echo '<td align="center">'.$row['Name'].'<br /><img src="'.$row['Image'].'" border="0" width="128" height="102" /></td>';
  echo '<td>'.$row['Description'].'</td>';
  echo '<td align="center">Rating: '.$rateround.'/5<br><a href="'.$link.'brokensite.sql.php?ID='.$ID.'" target="_new">Report Broken Link</a></td>';
  echo "<br />";
  }

 

how could I display that for every lines, rather than just the line where ID = 1

Link to comment
https://forums.phpfreaks.com/topic/111575-display-all-of-a-table-as-a-table/
Share on other sites

i mean I have a table that says, for example because tis not fully filled in yet

 

ID  	 Name  	 url  	 Image  	 Description  	 Rating  	 Ratings  	 Broken
1 	MadnessRed 	http://madnessred.co.cc/ 	http://madnessred.co.cc/img/siteprev.jpg 	My Website 	5 	1 	0
2 	Google	http://www.google.co.uk/ 	NULL 	A good search engine 	7 	2 	0

 

now the code I posted would make a table with 1 line showing ID1, madnessred.co.cc

 

How can i make it so the (html) table has more lines and shows the entire table?

Archived

This topic is now archived and is closed to further replies.

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