Ok, I have a question about getting information from 2 different tables in a database...
heres my code: In this code I have a list of squads I pull out of a table called "squads" - and as you can see there is a limit and multiple pages but anyways...
I also have a table called "players" where in the players table there is a row called "squadid" - where the id of a squad in the squad database is there so they can be inentified in their squad.
What I want to do is display all of the players in the player database with a certain squadid - which matches the id of the squad in the squad database. How would I go about putting another script in there - where, how ? 😃 lol...
<?php
$db = mysql_connect("localhost","xxx","password");
mysql_select_db (xxx);
if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}
$max_results = 15;
$from = (($page * $max_results) - $max_results);
results
$sql = mysql_query("SELECT * FROM squads WHERE activated='1' ORDER BY username LIMIT $from, $max_results");
while($row = mysql_fetch_array($sql)) {
echo "<font face=Verdana size=1 color=938F7D><B>» </B><font face=Verdana size=3 color=FFFFFF><a href=squad.php?userid=".$row["userid"]."> <B>".$row["squad_name"]."</B></a><br><font face=Verdana size=3 color=938F7D><B>".$row["squad_tags"]."</B><font face=Verdana size=1 color=FFFFFF> | <a href=mailto:".$row["email_address"]."><font face=Verdana size=1 color=FFFFFF>Email Address</a> - <a href=>Message <img src=http://web.icq.com/whitepages/online?web=".$row["icq"]."&img=5 border=0><br><br>";
}
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM squads"),0);
// Figure out the total number of pages. Always round up using ceil()
$total_pages = ceil($total_results / $max_results);
// Build Page Number Hyperlinks
echo "<br><B>Select a Page</B><br />";
// Build Previous Link
if($page > 1){
$prev = ($page - 1);
echo "<a href=\"squads.php?page=$prev\"><font face=Verdana size=1 color=938F7D><B>«</B><Previous</a> ";
}
for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a href=\"squads.php?page=$i\">$i</a> ";
}
}
// Build Next Link
if($page < $total_pages){
$next = ($page + 1);
echo "<a href=\"squads.php?page=$next\">Next<font face=Verdana size=1 color=938F7D><B>»</B></a>";
}
echo "";
?>