usadarts Posted August 9, 2007 Share Posted August 9, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/64007-passing-parm-in-url/ Share on other sites More sharing options...
teng84 Posted August 9, 2007 Share Posted August 9, 2007 what do you expect ??????? Quote Link to comment https://forums.phpfreaks.com/topic/64007-passing-parm-in-url/#findComment-319039 Share on other sites More sharing options...
usadarts Posted August 9, 2007 Author Share Posted August 9, 2007 playername, tournament, event and placed to appear on page from information within database file. Quote Link to comment https://forums.phpfreaks.com/topic/64007-passing-parm-in-url/#findComment-319043 Share on other sites More sharing options...
teng84 Posted August 9, 2007 Share Posted August 9, 2007 are you saying you want that to appear when the link is clicked hmmm is this an ajax or done by refreshing the page please explain how it work Quote Link to comment https://forums.phpfreaks.com/topic/64007-passing-parm-in-url/#findComment-319045 Share on other sites More sharing options...
usadarts Posted August 9, 2007 Author Share Posted August 9, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/64007-passing-parm-in-url/#findComment-319047 Share on other sites More sharing options...
usadarts Posted August 9, 2007 Author Share Posted August 9, 2007 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) Quote Link to comment https://forums.phpfreaks.com/topic/64007-passing-parm-in-url/#findComment-319074 Share on other sites More sharing options...
pranav_kavi Posted August 9, 2007 Share Posted August 9, 2007 <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..) Quote Link to comment https://forums.phpfreaks.com/topic/64007-passing-parm-in-url/#findComment-319130 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.