View Full Version : javascript in a php while loop

02-20-2009, 05:38 AM
i'm a self-taught programmer, and my forte is getting snippets and manipulating them because i'm not that great of a programmer. i recently came across jQuery because they had a cool tooltip type popup box that seems easily manipulatable (called cluetip). i'm using php to recall a list of players' names for a football team from a mysql database. i'd like to make each name linkable to result in a stat page that pops up via the javascript. so far i've only been able to get the first name in the list to work as a popup, and the others just open the stat page in the full browser window. without further ado, here is the code (simplified for clarity):


<script type="text/javascript">
activation: 'click',
width: 650,
cluetipClass: 'jtip',
arrows: true,
dropShadow: true,
hoverIntent: false,
sticky: true,
mouseOutClose: false,
ajaxCache: false,
closePosition: 'title',
closeText: '<img src="../images/cross.png" alt="close" />'


<body class="thrColLiqHdr">


$query = "select pPos, pNumber, pUID, pFname, pLname, pCondition, pInjured, pFace, pRace, pOrigPos, ttCity, ttName, ttTecmoOrder from tecmoplayer, tecmoteam where (pInjured > 0 OR pInjReturned = 1) AND plUID = ".$_SESSION["lID"] ." AND plUID = ttlUID AND ttTecmoOrder = pttUID order by ttTecmoOrder, pInjured desc";

<table width="220" border="0" cellspacing="0" cellpadding="2" align="center">
<td align="center" valign="middle" colspan="3"><font color="#cccccc" size="3"><strong><u>Injury Report</u></strong></font><br><br></td>
<?php while($inj_row = mysql_fetch_array($injuries_ret)){

$inj_pos = "QB";
$inj_pos = "RB";
$inj_pos = "WR";
$inj_pos = "TE";

<td width="35" height="45" align="center" valign="middle"><img src="../images/faces/<?php echo $face;?>.BMP" border="1"></td>
<td width="135"><?php echo "<a class='jt' href='dsp_player_atts_small.php?pID=".$inj_row["pUID"]."' rel='dsp_player_atts_small.php?pID=".$inj_row["pUID"]."' title='#".$inj_row["pNumber"]."&nbsp;".$inj_row["pFname"]."&nbsp;".$inj_row["pLname"]."&nbsp;-&nbsp;$inj_pos'>".$inj_row["pFname"]."&nbsp;".$inj_row["pLname"]."</a>";?><br>
<em><?php echo "<a class='navLight' href='dsp_roster.php?tID=".$inj_row["ttTecmoOrder"]."'>". $pos_ar[$inj_row["pOrigPos"]]. " - " .$inj_row["ttCity"]. "</a>";?></em></td>
<td width="38" align="center"><img src="../images/<?php echo $tmp_inj_image;?>" border="1"></td>
<?php }


(obviously i've edited major elements such as link to external files and possibly some php variables that are unimportant). it seems like it should be an easy fix, but i haven't been able to work it out, nor have i had any luck in understanding an answer from googling.
Thanks in advance!