CODE TO show values inside a table..!!!!

Discussion in 'PHP' started by avvishnu, Jul 12, 2007.

  1. #1
    hai...friends....
    i need to know the code for showing the values of tables in the webpage wchich are selected from the database. if there are 3 row , 3 cloumn of data in the database, i need to show the 3 row 3 cloumn values inside a table in the webpage. i think for that need dyanamic display code is needed. so please anyone help me. i dont no much about php.

    Love and Prayer

    a v vishnu
     
    avvishnu, Jul 12, 2007 IP
    nabil_kadimi likes this.
  2. nabil_kadimi

    nabil_kadimi Well-Known Member

    Messages:
    1,065
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    195
    #2
    
    $myQuery="SELECT id,name FROM customers WHERE age<25 limit 10"; //for example
    $myResult=mysql_query($myQuery);
    $numberOfRows=mysql_num_rows($myResult);
    
    if($numberOfRows!=0)
        echo "<table>";
    while($row=mysql_fetch_assoc($myResult)){
        echo "<tr><td>$row[id]</td><td>$row[name]</td></tr>";
    }
    if($numberOfRows!=0)
        echo "</table>";
    
    PHP:
     
    nabil_kadimi, Jul 12, 2007 IP
  3. 4GU.RU

    4GU.RU Member

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    Try this too
     
    4GU.RU, Jul 12, 2007 IP
  4. nabil_kadimi

    nabil_kadimi Well-Known Member

    Messages:
    1,065
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    195
    #4
    Yes, sorry, I didn't read "i need to show the 3 row 3 cloumn values inside a table"
     
    nabil_kadimi, Jul 12, 2007 IP
  5. 4GU.RU

    4GU.RU Member

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #5
    best way ...
     
    4GU.RU, Jul 12, 2007 IP