aingaran
09-22-2003, 08:34 PM
Can someone please help me with FPDF?
I don't know where to start! I can barely get the 'hello world' example to work.
What I'm trying to do is basically grab a bunch of data from a mysql db, and create a PDF file. The PDF file would have to have tables.
If someone can direct me as to where I should start, it would be great!
Thanks,
Here's basically what the php part is (without the pdf...)
<?
// db connection info.
$q = "SELECT * FROM invoices WHERE id = '$id'";
$r = mysql_query($q);
if (!$r)
{
echo mysql_error();
}
else
{
if (mysql_num_rows($r) < 1)
{
echo "unable to find record.";
}
else
{
while ($invoice = mysql_fetch_assoc($r))
{
print "<table width=500 cellpadding=5 cellspacing=1 border=0>";
print "<tr>";
print "<td>INVOICE #</td>";
print "<td>$invoice[id]</td>";
print "</tr>";
print "<tr>";
print "<td>AMOUNT DUE</td>";
print "<td>$invoice[due]</td>";
print "</tr>";
print "<tr>";
print "<td>INVOICE DATE</td>";
print "<td>$invoice[date]</td>";
print "</tr>";
print "</table>";
}
}
}
?>
I don't know where to start! I can barely get the 'hello world' example to work.
What I'm trying to do is basically grab a bunch of data from a mysql db, and create a PDF file. The PDF file would have to have tables.
If someone can direct me as to where I should start, it would be great!
Thanks,
Here's basically what the php part is (without the pdf...)
<?
// db connection info.
$q = "SELECT * FROM invoices WHERE id = '$id'";
$r = mysql_query($q);
if (!$r)
{
echo mysql_error();
}
else
{
if (mysql_num_rows($r) < 1)
{
echo "unable to find record.";
}
else
{
while ($invoice = mysql_fetch_assoc($r))
{
print "<table width=500 cellpadding=5 cellspacing=1 border=0>";
print "<tr>";
print "<td>INVOICE #</td>";
print "<td>$invoice[id]</td>";
print "</tr>";
print "<tr>";
print "<td>AMOUNT DUE</td>";
print "<td>$invoice[due]</td>";
print "</tr>";
print "<tr>";
print "<td>INVOICE DATE</td>";
print "<td>$invoice[date]</td>";
print "</tr>";
print "</table>";
}
}
}
?>
