Hi
I am trying to work out how to add a loop statement to my pdf generation (I think that's what I need).
I have a mysql table - events with 3 fields - id, name and date.
In my php page which is to generate the pdf I have:
mysql_select_db($database_events, $events);
$result = mysql_query("SELECT id, date, name
FROM events_pbw
WHERE id>200
");
while($row = mysql_fetch_array($result))
{
$id = $row['id'];
$date = $row['date'];
$name = $row['name'];
}
and in amongst the $html part of the page I have:
$html ="<html>
$id<br>
$name<br>
$date<br>
<i>This is a test calendar.</i>
This all works fine but (obviously) just gives one result. What do I need to add to make it list out all of the possible events?
Many thanks in advance.
TCPDF and Loop
Moderator: General Moderators
Re: TCPDF and Loop
use a foreach loop, or echo them straight from the query after the while statement. Would be a lot easier to help if you posted up the whole page so I can see where these are and how you are implimenting them