Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

create table

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

create table

Postby jhaustein » Fri Oct 18, 2002 12:36 pm

hey unity
i´ve a new prob. mybe you can help me
mysql table

tag____bord1____board2____board3___board4
1.1.___kai_______kai______bernd_____karl
2.1.___kai_______karl
3.1.___bernd
4.1.___karl______kai

now i want to have an html table with following stucture

____________1.1._______2.1._______3.1._______4.1.
board1____kai________kai_______bernd_______karl
board2______kai_______karl___________________kai
board3__bernd
board4______________________________________



:-) jörg
jhaustein
New php-forum User
New php-forum User
 
Posts: 4
Joined: Thu Oct 17, 2002 6:23 am

Postby DoppyNL » Fri Oct 18, 2002 1:15 pm

first build you're query
Load all the data in an array -> all records, not just one record.

Then build some nice loops so that you can build you're table one row at a time. -> you're walking throught you're entire array a couple of times.

Bit of common sence should be able solve this.
Sometimes drawing a smaller table out on paper helps in determining what to do exactly.

Greetz Daan
DoppyNL
 

Postby jhaustein » Fri Oct 18, 2002 1:17 pm

problem is i´m a newbie - do you have any code idea?

:-) jörg
jhaustein
New php-forum User
New php-forum User
 
Posts: 4
Joined: Thu Oct 17, 2002 6:23 am

Postby DoppyNL » Fri Oct 18, 2002 1:22 pm

Code: Select all
$query=mysql_query("SELECT * FROM `table`");

echo "<table width=800 border=0>";
while($data=mysql_fetch_array($query))
{
echo"<tr><td>$data[1]</td><td>$data[2]</Td><td>$data[3]</td></tr>";
}
echo "</table>";

This is a standard method of printing a table from a database in a file.(tnx Pejone) You could adapt it to do it what you want.
I'm here to help out with problems (and learn stuff myself ofcourse), not for writing code.

Greetz Daan
DoppyNL
 


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.