SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    May 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problem displaying info from mysql query

    I wrote this code awhile ago and now it's no longer working. My goal is to display the $xp query but the Event Type is a number field. That number field correlates to text in another table Lookup-XPType - 'id' = 'XP Type' in the echo $eventarray[$xpl['id']]; i'm trying to get that number changed to the text from the Lookup-XPType table. I hope this makes sense.



    PHP Code:
    <?php
    echo "<p />";
    echo 
    "<b> Event History </b>";
    echo 
    "<p />";
    echo 
    "<table border='1'>";
    echo 
    "<tr> <th>Date</th> <th>Starting XP</th> <th> Finish XP </th> <th> Event Type </th> <th> Info </th> </tr>";
    // keeps getting the next row until there are no more to get
    $poo $dow['Cnumber'];
    $xp "SELECT * FROM XPtrack WHERE Cnumber=$poo ORDER BY date";
    $xplist mysql_query($xp) or die(mysql_error());
    $eventarray = array();
    $eventresult mysql_query("SELECT * FROM `Lookup-XPType`") or die(mysql_error());
    while(
    $eventrow mysql_fetch_assoc($eventresult)){
      
    $eventarray[$eventrow['id']] = $eventrow['XP Type'];

    while(
    $xpl mysql_fetch_array($xplist)){
        
    // Print out the contents of each row into a table
        
    echo "<tr><td>"
        echo 
    $xpl['date'];
        echo 
    "</td><td>"
        echo 
    $xpl['startxp'];
            echo 
    "</td><td>";
            echo 
    $xpl['finxp'];
            echo 
    "</td><td>";
         echo 
    $eventarray[$xpl['id']];
            echo 
    "</td><td>";
            echo 
    $xpl['info'];
            echo 
    "</td></tr>";
            }
    echo 
    "<hr />";
    echo 
    "</table>";
    ?>

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2004
    Location
    Michigan
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Where is $eventrow coming from?

  3. #3
    SitePoint Member
    Join Date
    May 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ... I was modifying a different file then the one included in the main php file.. i was able to get this resolved. Thank you anyway!


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
  •