All pastes #132292 Raw Edit

Miscellany

public text v1 · immutable
#132292 ·published 2006-08-15 07:02 UTC
rendered paste body
<?php
// Connect to the database
$db = mysql_connect("localhost","root","");
mysql_select_db ("sixsigma");
// Ask the database for the information from the links table
$result = mysql_query("SELECT * FROM links");
// Now we print out the results, starting by making a table
echo "<table border = '0' width = '100%' align='center'>";
while ($rows = mysql_fetch_row($result))
// Here we make the script keep making new rows until all the links in our database are shown, this is called a loop
{
echo "<tr><td><a href='$rows[2]'>$rows[1]</a></td></tr>";
}
// Finally we close off the table
echo "</table>";

//print all general links with subcategory?
$result = mysql_query("SELECT * FROM links WHERE category = 'general' ORDER BY subcategory");
echo "General Links";
echo "<ul>";
while ($rows = mysql_fetch_row($result))
{
 echo "<li><a href='$rows[2]'>$rows[1]</a>,$rows[4]</li>";
}
echo "</ul>";

?>