[dba-VB] How hard are reports like this?

Stuart McLachlan stuart at lexacorp.com.pg
Wed Jan 4 06:35:07 CST 2012


For that sort of thing, you use a server side engine to extract the data from a database 
(normally using SQL) and embed it into HTML tags.  You can use ASP(classic or .Net), PHP 
or a CGI application built in whatever will run on your server.

Your ASP,PHP,CGI application just builds the HTML page and passes it back to the  web 
server which delivers it to the client.

Normally, you would start by designing a static HTML page for the report layout and then 
chop it up and intersperse the pieces of HTML with ASP/PHP/CGI code to insert the data 
pulled from the database.
 
Here's a very simple PHP script to retrieve data from a MySQL database and returing it in a 
tabular report. Even without any experience of PHP, you should be able to follow it easily.

<?php
$con = mysql_connect('localhost', 'user', 'pword');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("demo", $con);

$sql="SELECT * FROM user";

$result = mysql_query($sql);

echo "<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
<th>Hometown</th>
<th>Job</th>
</tr>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['FirstName'] . "</td>";
  echo "<td>" . $row['LastName'] . "</td>";
  echo "<td>" . $row['Age'] . "</td>";
  echo "<td>" . $row['Hometown'] . "</td>";
  echo "<td>" . $row['Job'] . "</td>";
  echo "</tr>";
  }
echo "</table>";

mysql_close($con);
?>

-- 
Stuart

On 4 Jan 2012 at 6:49, jwcolby wrote:

> My question is really about general report generation techniques.  I have no idea how a report like 
> this would be generated - the environment / code required.
> 
> John W. Colby
> Colby Consulting
> 
> Reality is what refuses to go away
> when you do not believe in it
> 
> On 1/4/2012 6:34 AM, Salakhetdinov Shamil wrote:
> > Hi John and Gustav and all --
> >
> >> That link times out here, but this:
> > It worked well here somehow even on Windows Phone 7.
> >
> >> shows a report of some kind - looks like clean HTML, not even ASP Classic stuff.
> > Yes.
> >
> >> Not quite sure what your question is?
> > Neither am I. (Is the question about data source used to generate report or about general report generation technique?)
> >
> > Thank you.
> >
> > -- Shamil
> >
> > 04  2012, 14:23  "Gustav Brock"<Gustav at cactus.dk>:
> >> Hi John
> >>
> >> That link times out here, but this:
> >>
> >> http://demos.buyerlogic.com/aleve/admin/
> >>
> >> shows a report of some kind - looks like clean HTML, not even ASP Classic stuff.
> >>
> >> Not quite sure what your question is?
> >>
> >> /gustav
> >>
> >>>>> jwcolby at colbyconsulting.com 04-01-2012 04:00>>>
> >> Anyone who understands developing web based reports, if you would go to this url.  It apparently
> >> takes them about 20-30 seconds to compute this however they did this.
> >>
> >> http://demos.buyerlogic.com/aleve/admin/report.aspx
> >>
> >> I may have an opportunity to take over developing reports like this for the client.  More work is
> >> always good if I can do it.
> >>
> >> --
> >> John W. Colby
> >> Colby Consulting
> >>
> >
> > _______________________________________________
> > dba-VB mailing list
> > dba-VB at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/dba-vb
> > http://www.databaseadvisors.com
> >
> 
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
> 






More information about the dba-VB mailing list