I have php code that retrieve data from mysql DB, and print it in html table.

<?
print "<table>";
$result=mysql_query("select fd1,fd2,fd3 from tbl");
for ($i = 0; $i < mysql_num_rows($result); ++$i)
{
$line = mysql_fetch_row($result);
print "<tr><td>$line[0]</td><td>$line[1]</td><td>$line[2]</td></tr>";
}
print "</table>";
?>

I have no problem to implement above code, this html table contains three columns while each column has multiple lines(rows).

Now in html table I want to merge rows by using ROWSPAN in first column, when DB field "fd2=1", display DB values(one or more) in this merged cell, and leave the other two columns prints row by row. As on web browser data are printed from top to bottom, is it possible to print DB multiple records in merged cell?
Thanks for any response.

Recommended Answers

All 2 Replies

I'm not sure what you want to do exactly... Can you provide an example?

Yes what you are asking is very unclear. But the definate answer is: anything is possible!

It sounds like you just need to tinker a little more, possibly loading your query into a mutlidimentional array so that you can process them more than once.

Try posting a static HTML example of the results you'd like.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.