Jump to content

Passing Parm in URL


usadarts

Recommended Posts

I have a persons name set as a link.

<a href="javascript:poptastic3('http://www.website.com/individual.php?playername=$name');" style="text-decoration:none; color:black; font-size:normal;" onMouseOver="this.style.fontStyle='italic'; this.style.color='black'" onMouseOut="this.style.fontStyle='normal'; this.style.color='black'">$name</a>

 

individual.php

<?php
$dbh=mysql_connect ("localhost", "blahblah", "blah") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("blah_results");

$query = "SELECT * FROM `2007results` WHERE `playername` = '$name'";
$result = mysql_query($query,$dbh) or die(mysql_error());

$results_header =<<<HEADER
<table cellspacing='1' align="center">
HEADER;

while($row = mysql_fetch_array($result))
{
$playername = $row['playername'];
$tournament = $row['tournament'];
$event = $row['event'];
$placed = $row['placed'] ;

$results_details .=<<<DETAILS
<tr>
<td>$tournament</td>
<td>$event</td>
<td>$placed</td>
</td>
</tr>

DETAILS;
}

$results_footer ="</table>";

echo $results_header;
echo $results_details;
echo $results_footer;
?>

 

Nothing is appearing on page.

Link to comment
Share on other sites

The name comes from a database file (field: $name)

When the name link is clicked, a popup page should appear with information from the database.

 

The link is currently set at:

http://www.website.com/individual.php?playername=$name

 

The individual.php should have information base on another database file in which playername = $name

Link to comment
Share on other sites

Not sure if I am explaining myself correctly.

Here is the code from Index.php

            <?php
$dbh=mysql_connect ("xxxxxxxx", "xxxxxxx_xxxxxxx", "xxxxxxx") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("xxxxxxx_xxxxxxx"); 

$rank = 0;
$regionk = $_GET['region'];
$assock = $_GET['assoc'];

if($regionk != '' && $regionk != 'ALL') {
$queryr = "SELECT * FROM `mens2007` WHERE `region` = '$regionk' and `regpts` > 0 ORDER BY `regpts` DESC";
$resultr = mysql_query($queryr,$dbh) or die(mysql_error());
} else if($assock != '' && $assock != 'ALL') {
$queryr = "SELECT * FROM `mens2007` WHERE `assoc` = '$assock' and `natpts` > 0 ORDER BY `natpts` DESC";
$resultr = mysql_query($queryr,$dbh) or die(mysql_error());
} else{
$queryr = "SELECT * FROM `mens2007` WHERE `natpts` > 0 ORDER BY `natpts` DESC";
$resultr = mysql_query($queryr,$dbh) or die(mysql_error());
} 



$resultr = mysql_query($queryr,$dbh) or die(mysql_error());

$results_header =<<<HEADER
<table cellspacing='1' align="center">
<tr>
<td valign=bottom><b>Ranking</b></td>
<td>     </td>
<td valign=bottom><b>Player</b></td>
<td>     </td>
<td valign=bottom><b>Region</b></td>
<td>     </td>
<td valign=bottom><b>Affiliation</b></td>
<td>     </td>
<td align=right valign=bottom><b>Regional<br>Points</b></td>
<td>     </td>
<td align=right valign=bottom><b>National<br>Points</b></td>


HEADER;

while($row = mysql_fetch_array($resultr))
{
    $rank = $rank + 1;
    $name = $row['firstname']." ".$row['lastname'];
    $region = $row['region'];
    $assoc = $row['assoc'];
    $regpts = $row['regpts'];
    $natpts = $row['natpts'];

$results_details .=<<<DETAILS
<tr>

<td><font size="3">$rank</font></td>
<td>     </td>
<td><font size="3"><a href="javascript:poptastic2('http://www.adodarts.com/rankings/mens2007new/individual.php?playername=$name');" style="text-decoration:none; color:black; font-size:normal;" onMouseOver="this.style.fontStyle='italic'; this.style.color='black'" onMouseOut="this.style.fontStyle='normal'; this.style.color='black'">$name</a></font></td>
<td>     </td>
<td><font size="3">$region</font></td>
<td>     </td>
<td><font size="3">$assoc</font></td>
<td>     </td>
<td align=right><font size="3">$regpts</font></td>
<td>     </td>
<td align=right><font size="3">$natpts</font></td>
</tr>
DETAILS;
}

$results_footer ="</table>";

echo $results_header;
echo $results_details;
echo $results_footer;
?> 

 

When clicking the name link in the above code, the popup window does appear but there is no information. I know the code in the individual.php is correct, because if I change $name to John Doe within the $query, it works.

 

Here is the individual.php code

<?php
$dbh=mysql_connect ("xxxxxxx", "xxxxxxx_xxxxxxx", "xxxxxx") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("xxxxxx_xxxxxx");

$query = "SELECT * FROM `2007results` WHERE `playername` = '$name' LIMIT 0, 999";
$result = mysql_query($query,$dbh) or die(mysql_error());

$results_header =<<<HEADER
$name 
<table cellspacing='1' align="center">
HEADER;

while($row = mysql_fetch_array($result))
{
$playername = $row['playername'];
$tournament = $row['tournament'];
$event = $row['event'];
$placed = $row['placed'] ;

$results_details .=<<<DETAILS
<tr>
<td>$tournament</td>
<td>$event</td>
<td>$placed</td>
</td>
</tr>

DETAILS;
}

$results_footer ="</table>";

echo $results_header;
echo $results_details;
echo $results_footer;
?>

 

Does it have something to do with a space within $name (ex: Joe Smith)

Link to comment
Share on other sites

<td><font size="3"><a href="javascript:poptastic2('http://www.adodarts.com/rankings/mens2007new/individual.php?playername=$name');" style="text-decoration:none; color:black; font-size:normal;" onMouseOver="this.style.fontStyle='italic'; this.style.color='black'" onMouseOut="this.style.fontStyle='normal'; this.style.color='black'">$name</a></font></td>

 

Instead of $name,ve u just tried putting 'Joe Smith' directly (just 2 check..)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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