Jump to content

Dynamic URL's


sws

Recommended Posts

Hi,

I am creating a fantasy sports pool and I have the standings displayed on the home page. It shows a table with the user_id and their point totals.

I want to change it so that each user id is an <a href> link to a url that will show a detailed view of their roster.

so if there user id is "whatever"  They can click the link that says whatever and it will take them to ultimatepoolies.com?user_id=whatever

How do I do this and more impoetantly how do I ensure that that file exists on my webserver ?

here is what I have now:

[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Ultimate Poolies - Compete against the world's ULTIMATE SPORTS POOLIES</title>
</head>
<body background="images/bg.gif">

<?php
include ("config.php");
# Include the config.php file here

error_reporting (E_ALL & ~ E_NOTICE);
# Don't show notices.

echo '<table align="center" border="0" cellpadding="0" cellspacing="0" width="850">
<tr>
    <td height="22" background="images/nav_bar_02.jpg"><font color="#FFFFFF"><p>Welcome to ULTIMATE POOLIES.com We are pleased to announce that our HOCKEY Contests are now in progress!!!</p></font></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><font face="SerpentineDBol" size="+3" color="#FF0000">Ultimate Poolies.com </font>';
if(!empty($online['id']))
{
  print'Welcome <b>'.stripslashes($online['username']). '</b>- <a href="logout.php">Logout</a><br />';
}
else
{
  print'<a href="login.php">Login | </a><a href="register.php">Register</a><br />';
}


?>
  </td>
  </tr>
  <tr>
    <td height="22" background="images/nav_bar_02.jpg"></td>
  </tr>
  <tr><td>
    <table border="1" cellpadding="2" cellspacing="0">
      <tr>
        <td width="150" bgcolor="#003399" align="center" valign="top">
<table bgcolor="#CCCCCC" width="148">
<tr>
  <td align="left"><a href="index.php">Home  </a></td>
</tr>
<tr>
  <td align="left"><a href="hockey_contests.php">Hockey Pools </a></td>
</tr>
<tr>
  <td align="left"><a href="#">Football Pools </a></td>
</tr>
<tr>
  <td align="left"><a href="#">Basketball Pools </a></td>
</tr>
<tr>
  <td align="left"><a href="#">Baseball Pools </a></td>
</tr>
<tr>
  <td align="left"><a href="upforums/index.php" target="_blank">Message Boards  </a></td>
</tr>
<tr>
  <td align="left"><a href="mailto:[email protected]">Contact U.P.</a></td>
</tr>
</table> 
</td>

<td width="530" bgcolor="#FFFFFF" valign="top"><br />
<table border="0" align="center" width="520">
<tr>
<td valign="top" align="center"><font color="#003366"><h2>
Welcome to Ultimate Poolies.com</h2></font>
</td>
</tr>
</table>
<table border="1" align="center">
<tr>
  <td colspan="3" align="center"><img src="images/hockey_stars.gif" /></td>
</tr>



<tr>
  <td colspan="2">
  <table border="1" bordercolor="#3366FF" width="100%" cellspacing="0" cellpadding="0">
  <tr><td colspan="2" bgcolor="#003399" align="center">
<p><font color="#FFFFFF"><b>Standings</b></font></p></td>
</tr>
<tr>
  <td width="100" align="center"><b>Manager </b></td><td align="center">  <b>Points</b></td>
</tr>

<?php
  $standings_sql = "SELECT b.handle AS manager, SUM(a.points) AS total FROM nhl_managers AS b LEFT JOIN nhl_players AS a ON(b.lw1 = a.id OR b.lw2 = a.id OR b.lw3 = a.id OR b.lw4 = a.id OR b.lw5 = a.id OR b.rw1 = a.id OR b.rw2 = a.id OR b.rw3 = a.id OR b.rw4 = a.id OR b.rw5 = a.id OR b.c1 = a.id OR b.c2 = a.id OR b.c3 = a.id OR b.c4 = a.id OR b.c5 = a.id OR b.d1 = a.id OR b.d2 = a.id OR b.d3 = a.id OR b.d4 = a.id OR b.d5 = a.id OR b.d6 = a.id OR b.d7 = a.id OR b.d8 = a.id OR b.d9 = a.id OR b.d10 = a.id OR b.g1 = a.id OR b.g2 = a.id OR b.g3 = a.id) GROUP BY manager ORDER BY total DESC";
$standings_query = mysql_query($standings_sql);
if (!$standings_query) {
  echo 'SQL error: ', mysql_error();
  exit; // error handling
}


while ($table_row = mysql_fetch_array($standings_query))
{
  ?>

<tr>
  <td><font face="Verdana, Times New Roman, Times, serif" size="-2" color="#990000">
  <?=$table_row['manager']?>
  </font>
  </td>
  <td><font face="Verdana, Times New Roman, Times, serif" size="-2" color="#990000">
  <?=$table_row['total']?>
  </font>
  </td>
 
</tr>
<?
}

?>


</table>
</td>
<td valign="middle" align="center"><a href="hockey_pickem_roster.php">Enter Today !</a><br /><a href="#">Rules</a></td>
</tr>


</table>

</td>
<td width="232" bgcolor="#CCCCCC" align="left" valign="top"><br /javascript news headlines here</td>
      </tr>
    </table>
</td>
  </tr>
</table>
</body>
</html>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/29250-dynamic-urls/
Share on other sites

Try changing:

[code]
while ($table_row = mysql_fetch_array($standings_query))
{
  ?>

<tr>
  <td><font face="Verdana, Times New Roman, Times, serif" size="-2" color="#990000">
  <?=$table_row['manager']?>
  </font>
  </td>
  <td><font face="Verdana, Times New Roman, Times, serif" size="-2" color="#990000">
  <?=$table_row['total']?>
  </font>
  </td>
 
</tr>
<?
}

?>
[/code]

to:

[code]
while ($table_row = mysql_fetch_array($standings_query))
{
echo "<tr>\n";
echo "<td>\n";
echo "<font face=\"Verdana, Times New Roman, Times, serif\" size=\"-2\" color=\"#990000\">";
echo "<a href=\"ultimatepoolies.com?user_id=".$table_row['manager']."\">";
echo $table_row['manager'];
echo "</a>";
echo "</font>\n";
echo "</td>\n";
echo "<td><font face=\"Verdana, Times New Roman, Times, serif\" size=\"-2\" color=\"#990000\">\n";
echo $table_row['total'];
echo "</font>\n";
echo "</td>\n";
echo "</tr>\n";
}

?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/29250-dynamic-urls/#findComment-134088
Share on other sites

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.