Results 1 to 1 of 1

Thread: javascript in a php while loop

  1. #1
    Join Date
    Feb 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default javascript in a php while loop

    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):

    Code:
    <html>
    <head>
    
    <script type="text/javascript">
    $(document).ready(function(){
    $('a.jt:eq(0)').cluetip({
      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" />'
    });
    });
    </script>
    
    </head>
    
    <body class="thrColLiqHdr">
    
    <?php 
                        	
                        $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";
                    	rs_query("injuries_ret",$query);
                    	
    <table width="220" border="0" cellspacing="0" cellpadding="2" align="center">	
      <tr>
    	<td align="center" valign="middle" colspan="3"><font color="#cccccc" size="3"><strong><u>Injury Report</u></strong></font><br><br></td>
      </tr>			
                    <?php while($inj_row = mysql_fetch_array($injuries_ret)){
    					
    					if($inj_row["pPos"]==0){
    						$inj_pos = "QB";
    					}elseif($inj_row["pPos"]==1){
    						$inj_pos = "RB";
    					}elseif($inj_row["pPos"]==2){
    						$inj_pos = "WR";
    					}elseif($inj_row["pPos"]==3){
    						$inj_pos = "TE";
    					}
                      ?>
    				  
      <tr> 
        <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>
      </tr>
      <?php }  
      ?>
    </table>
    
    </body>
    </html>
    (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!

    ~brookston
    Last edited by brookstonfowler; 02-20-2009 at 05:44 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •