Boy am I glad I found this place. Using PHP for the first time for a pet project and I've sort of got most of the basics figured out now, so I can write and read data from a MySQL database. Haven't figured out how to edit or update it once I have it in the DB yet, but that's the next problem.
The issue I have for now is: How can I format the output of a foreach loop, to make the data returned to a browser loop a bit neater? I messed about with HTML <p> tags and Tables, but nothing really works very well. I'm comfortable with HTML and XHTML, but I can't tell if its PHP is just throwing me or I'm missing something.
The code I have so far is
<?php if(sizeof($events) > 0): ?>
<p class="blkbld"><?php foreach($events as $event): ?>
<?php echo $event->name; ?> <?php echo date("D jS M, Y", strtotime($event->date)); ?> <a href="index2.php?id=<?php echo $event->event_id; ?>">Full Details</a><br />
<?php endforeach; ?></p>
<?php else: ?>
<p class="bluebld">No events currently defined.</p>
<?php endif; ?>
The event table contains about 50 rows already and thats a fraction of the live data it will eventually have, so I want to solve this now, before I code myself completely into a corner. Be gentle with me, I hadn't really touched PHP until last Saturday. If I'm doing it all wrong, tell me nicely
Thanks
Rick