Forum Moderators: coopster

Message Too Old, No Replies

An example of a simple report

         

Shaman13

8:29 pm on Dec 16, 2004 (gmt 0)

10+ Year Member



Does anyone have a simple example of a report I can look at to help me with formatting. I am using MySQL and Php. I have a working query that extracts the data I want but I am unsure how to render it in html.

Thanks

StupidScript

10:02 pm on Dec 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Write a normal HTML page in the style of the report you want, and echo your PHP data in the appropriate places, similar to:

<table border=1 cellpadding=4 cellspacing=0>

<tr><th colspan=3>Report</th></tr>

<tr><th>Date</th><th>Item</th><th>Code</th></tr>

<?

while($row=mysql_fetch_array($your_mysql_query)) {

$thisdate=$row["date"];

$thisitem=$row["item"];

$thiscode=$row["code"];

print("<tr><td>$thisdate</td><td>$thisitem</td><td>$thiscode</td></tr>\n");

}

?>

</table>

The fun part is designing your report! :)