Problems with detailed linkpage
Moderator: General Moderators
-
warriors2003
- Forum Commoner
- Posts: 38
- Joined: Wed Mar 24, 2004 7:24 pm
Problems with detailed linkpage
Ok,,I have an overall Baseball Stats table. I want it so when you click on the player, it will then take you to the game by game breakdown page for that player listing all his games.
Overall Stats are located in a table "hit"
I have hit_id as auto, prim, unique
The individual game stats are in "hitg"
it has hitid, no auto, no prim, no unique, and feeds quite well from the hit_id i have from the submit form.
The form I have works, everythign goes into the two tables nicely. One adds them up "hit", the other keeps them all seperate "hitg".
Here is the problem,,,In the overall stats table i'm using this as the link in the code to take you to the hitplayer breakdown page
echo "<a href=hitplayer.php?hit_id=$row[hit_id]>";
Now the problem I';m having is making that hitplayer.php page. I've been looking around, try different codes, but can;t get one to work. I don;t know if its becuase I have soemthign screwy in the field name in the table or hit id's are conflicting.
Here is what i picked up from doing some reasearch
CODE--------------------------
<?
mysql_query("select * from hitg where hitid = '$hit_id'");
?>
<tr>
<td align=center valign=top><B>AB</B></td>
<td align=center valign=top><B>hits</B></td>
<td align=center valign=top><B>hr</B></td>
</tr>
<?
// Display requested entries
while ( $row = mysql_fetch_array($result) ) {
echo("<tr>
<td align=center valign=top>
". $row["ab"] . "</td>
<td align=center valign=top>
" . $row["h"] . "</td>
<td align=center valign=top>
" . $row["hr"] . "</td></tr>");
}
?>
____________________ End Code
I know their maybe something screwy with the id and how i have it setup in the query, or maybe its in the linkage to i dunno.
Its just a matter of querying just the ID's games in the breakdown on hitg and displaying them right from the link that is throwing me off.
THANKS SO MUCH IN ADVANCE!!
Overall Stats are located in a table "hit"
I have hit_id as auto, prim, unique
The individual game stats are in "hitg"
it has hitid, no auto, no prim, no unique, and feeds quite well from the hit_id i have from the submit form.
The form I have works, everythign goes into the two tables nicely. One adds them up "hit", the other keeps them all seperate "hitg".
Here is the problem,,,In the overall stats table i'm using this as the link in the code to take you to the hitplayer breakdown page
echo "<a href=hitplayer.php?hit_id=$row[hit_id]>";
Now the problem I';m having is making that hitplayer.php page. I've been looking around, try different codes, but can;t get one to work. I don;t know if its becuase I have soemthign screwy in the field name in the table or hit id's are conflicting.
Here is what i picked up from doing some reasearch
CODE--------------------------
<?
mysql_query("select * from hitg where hitid = '$hit_id'");
?>
<tr>
<td align=center valign=top><B>AB</B></td>
<td align=center valign=top><B>hits</B></td>
<td align=center valign=top><B>hr</B></td>
</tr>
<?
// Display requested entries
while ( $row = mysql_fetch_array($result) ) {
echo("<tr>
<td align=center valign=top>
". $row["ab"] . "</td>
<td align=center valign=top>
" . $row["h"] . "</td>
<td align=center valign=top>
" . $row["hr"] . "</td></tr>");
}
?>
____________________ End Code
I know their maybe something screwy with the id and how i have it setup in the query, or maybe its in the linkage to i dunno.
Its just a matter of querying just the ID's games in the breakdown on hitg and displaying them right from the link that is throwing me off.
THANKS SO MUCH IN ADVANCE!!
-
warriors2003
- Forum Commoner
- Posts: 38
- Joined: Wed Mar 24, 2004 7:24 pm
THANKS FOR YOUR HELP!!! However it didn't work,,i'm starting to think something is screwy in the tables with the ID's?? or maybe the link I used?? Do I need to edit that?
I used this and no results showed up. I put in what you added.
<?
mysql_query("select * from hitg where hitid = '{$_GET['hit_id']}'") or die(mysql_error());
?>
<tr>
<td align=center valign=top><B>AB</B></td>
<td align=center valign=top><B>hits</B></td>
<td align=center valign=top><B>hr</B></td>
</tr>
<?
// Display requested entries
while ( $row = mysql_fetch_array($result) ) {
echo("<tr>
<td align=center valign=top>
". $row["ab"] . "</td>
<td align=center valign=top>
" . $row["h"] . "</td>
<td align=center valign=top>
" . $row["hr"] . "</td></tr>");
}
?>
-----------------------
Any ideas to what could be causing no output?
Thanks again for taking time out to try to help me!
I used this and no results showed up. I put in what you added.
<?
mysql_query("select * from hitg where hitid = '{$_GET['hit_id']}'") or die(mysql_error());
?>
<tr>
<td align=center valign=top><B>AB</B></td>
<td align=center valign=top><B>hits</B></td>
<td align=center valign=top><B>hr</B></td>
</tr>
<?
// Display requested entries
while ( $row = mysql_fetch_array($result) ) {
echo("<tr>
<td align=center valign=top>
". $row["ab"] . "</td>
<td align=center valign=top>
" . $row["h"] . "</td>
<td align=center valign=top>
" . $row["hr"] . "</td></tr>");
}
?>
-----------------------
Any ideas to what could be causing no output?
Thanks again for taking time out to try to help me!
-
warriors2003
- Forum Commoner
- Posts: 38
- Joined: Wed Mar 24, 2004 7:24 pm
-
warriors2003
- Forum Commoner
- Posts: 38
- Joined: Wed Mar 24, 2004 7:24 pm
Do you think my link is the problem here?
echo "<a href=hitplayer.php?hit_id=$row[hit_id]>";
Also how exactly should i include the debug in the page and where do i need to put it? Sorry if its a basic question, sometimes i can do real advance things then simple stuff i got lost on
here is the overall table then you can click on a player
http://www.becauseitscool.com/htables22.php
echo "<a href=hitplayer.php?hit_id=$row[hit_id]>";
Also how exactly should i include the debug in the page and where do i need to put it? Sorry if its a basic question, sometimes i can do real advance things then simple stuff i got lost on
here is the overall table then you can click on a player
http://www.becauseitscool.com/htables22.php
-
warriors2003
- Forum Commoner
- Posts: 38
- Joined: Wed Mar 24, 2004 7:24 pm
Thanks so much for trying to helP!!!
This is what i have, i added in what you gave me
Code--------------------------------
<?
mysql_query("select * from hitg where hitid = '{$_GET['hit_id']}'") or die(mysql_error());
?>
<tr>
<td align=center valign=top><B>AB</B></td>
<td align=center valign=top><B>hits</B></td>
<td align=center valign=top><B>hr</B></td>
</tr>
<?
// Display requested entries
while ( $row = mysql_fetch_array($result) ) {
echo("<tr>
<td align=center valign=top>
". $row["ab"] . "</td>
<td align=center valign=top>
" . $row["h"] . "</td>
<td align=center valign=top>
" . $row["hr"] . "</td></tr>");
}
?>
End Code-------------------------
This is what i have, i added in what you gave me
Code--------------------------------
<?
mysql_query("select * from hitg where hitid = '{$_GET['hit_id']}'") or die(mysql_error());
?>
<tr>
<td align=center valign=top><B>AB</B></td>
<td align=center valign=top><B>hits</B></td>
<td align=center valign=top><B>hr</B></td>
</tr>
<?
// Display requested entries
while ( $row = mysql_fetch_array($result) ) {
echo("<tr>
<td align=center valign=top>
". $row["ab"] . "</td>
<td align=center valign=top>
" . $row["h"] . "</td>
<td align=center valign=top>
" . $row["hr"] . "</td></tr>");
}
?>
End Code-------------------------
-
warriors2003
- Forum Commoner
- Posts: 38
- Joined: Wed Mar 24, 2004 7:24 pm
-
warriors2003
- Forum Commoner
- Posts: 38
- Joined: Wed Mar 24, 2004 7:24 pm
Ack..i missed the most obvious error right from the start, sorry.
You have:
mysql_query("select * from hitg where hitid = '{$_GET['hit_id']}'") or die(mysql_error());
that needs to be:
$result = mysql_query("select * from hitg where hitid = '{$_GET['hit_id']}'") or die(mysql_error());
otherwise the result returned is lost, ie not assigned to anything for the mysql_fetch_array() to work
You have:
mysql_query("select * from hitg where hitid = '{$_GET['hit_id']}'") or die(mysql_error());
that needs to be:
$result = mysql_query("select * from hitg where hitid = '{$_GET['hit_id']}'") or die(mysql_error());
otherwise the result returned is lost, ie not assigned to anything for the mysql_fetch_array() to work
-
warriors2003
- Forum Commoner
- Posts: 38
- Joined: Wed Mar 24, 2004 7:24 pm