Re: How to display table columns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Well, you would create a table like this
echo "<table><tr><td>name</td><td>age</td><td>sex</td></tr>";
Then, you would do a query (assuming you've already made a connection to
your database)...
$result = mysql_query("SELECT name,age,sex FROM database.usertable");
Then, run through  the results...
    while ($row = mysql_fetch_assoc($result))
{ 
  echo
  "<tr><td>".$row["name"]."</td><td>".$row["age"]."</td><td>".$row["sex"]."</td></tr>";
}
Then, end the table like this
echo "</table>";
There you have it.

----- Original message -----
From: "andy amol" <andy_amol_2003@xxxxxxxxx>
To: php-db@xxxxxxxxxxxxx
Date: Sun, 25 Apr 2004 19:47:37 -0700 (PDT)
Subject:  How to display table columns

hi,
  I want to display the table coulumns along with those values below it.
  I am only able to display the table values, now I want to diplay the
  corresponding table attribut above the value.
 
eg : name     age     sex
       abc        1        m
       xyz         2        f
 
I want to display name, age and sex.
 
I am using mysql as database.
 
thanks in advance.
 

		
---------------------------------
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
-- 
  Marcjon

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux