Something like this should work. You can add more data to each row if you want.
Code:<?php
mysql_connect("localhost","username","password");
mysql_select_db("database_name");
$id = (int)$_GET['id'];
$query = mysql_query("SELECT * FROM teams");
if(mysql_num_rows($query) == 0)
{
echo "No Teams";
} else {
echo "<table>";
while($row = mysql_fetch_assoc($query))
{
echo "<tr><td><a href=\"teaminfo.php?id=".$row['id']."\">".$row['TeamName']."</a></td></tr>";
}
echo "</table>";
}
?>
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/northsta/public_html/tmp/teamsnew.php on line 9
No Teams
Replace
$query = mysql_query("SELECT * FROM teams");
with
$query = mysql_query("SELECT * FROM teams") or die(mysql_error());
Paste back here what it says.
No database selected
You did fill in your database name in the "mysql_select_db("database_name");", right?
working now, i had the wrong database
That'll do it everytime.
Need help with anything else?
Check your personal messages, last question, i think!![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks