Help - Need to put Info into Table

Discussion in 'PHP' started by BMXRider09, Mar 23, 2009.

  1. #1
    Not sure how to do this, but with a game script (see section below), how can I put the information on the database into a table that the user can see. In this case it is the game estate agent and I want 3 columns, with the name of the house, the cost and "Max Will" as the headers for each column. then, I want 1 house plus the properties of that house in the correct column for each line.




    Something that looks like this is what I am after:

    [​IMG]


    All the information is currently in the database, but how do I format it into a table? I would appreciate if you could reply with the whole script which has been modified to accomplish this.
     
    BMXRider09, Mar 23, 2009 IP
  2. javaongsan

    javaongsan Well-Known Member

    Messages:
    1,054
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    128
    #2
    echo '<table><tr><td>House Name</td><td>Price</td><td>Will</td>';
    $npq=$db->query("SELECT * FROM houses WHERE hWILL={$ir['maxwill']}");
    while ($np=$db->fetch_row($npq))
    	echo '<tr><td>'.$np['hNAME'].'</td><td>'.$np['hPRICE'].'</td><td>'.$np['maxwill'].'</td><.tr>';
    echo '</tr></table>';	
    
    Code (markup):
     
    javaongsan, Mar 23, 2009 IP
    BMXRider09 likes this.
  3. BMXRider09

    BMXRider09 Peon

    Messages:
    164
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    +Rep

    Thanks, your a lifesaver :D
     
    BMXRider09, Mar 24, 2009 IP