Re: How to display table columns
| From: | Marcjon Louwersheimer | Date: | Mon, 26 Apr 2004 03:24:29 +0000 |
| Subject: | Re: How to display table columns | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-34088@lists.php.net to get a copy of this message | ||
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@yahoo.com>
To: php-db@lists.php.net
Date: Sun, 25 Apr 2004 19:47:37 -0700 (PDT)
Subject: [PHP-DB] 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