SEO Services
Home >> Webmaster Forums >> building table displays in php

building table displays in php


edwin said: "ok, whenever i retrieve content from a mysql database, i know i have to format it into a table for tabular display, but i'm not sure of the particulars. [code] echo ""; while ($uRow = $uResult->fetchRow()) { if (!$uRow[5]) { if (!$uRow[10]) { $i++; echo ""; echo "

"; } } } echo "
$uRow[1]
"; echo "$uRow[2]
"; [/code] can anyone see what's wrong in that code?"

Darksat said: "Are those 2 if commands supposed to be there, isnt there supposed to be some form of and or if variable, also do you know what line the error is on?"

edwin said: "yeah, the code works. i think i need colspan and rowspan but i didn't have much luck getting it to display in tabular format."

<h1> said: "Ok i'm not sure your methods here edwin there's quite a few errors with that code. So you want to create a table as follows: [HTML]
dbentry
dbentry2
[/HTML] The above is the correct tags for a table. A line in your code reads: echo "$uRow[2]

"; You cannot put the tag before the tag, and what is that

tag doing there? That might be your problem. Remeber to display html text without backslashing those quotes, use echo ''; (note the single quotes) hope this helps peace, Rich"

edwin said: "it lines up okay now, but still now columns. i get the impression that i should use "colspan" and "rowspan" but i don't know if those are compatible with external stylesheet.s"

<h1> said: "Okay dude lets say you want 1 row and 2 columns below that row, then only you would use colspan. Where say if you want 1 column and 2 rows next to it you would use rowspan. If you just want to create a 2 column table then do as follows: [HTML]
1st column2nd column
[/HTML] and with a row: [HTML]
1st row
1st column2nd column
[/HTML] [QUOTE]but i don't know if those are compatible with external stylesheet.s[/QUOTE] You won't be able to define rowspan or colspan from a stylesheet."