I'm creating events CMS and i'm some difficulty with getting the data from the table in the mysql to display if a format that i would like. Also, for some reason the data is is replicating the event number across all fields.
<?php
require("includes/con.php");
?>
<?php
$queryVENUE = "SELECT * FROM venue ORDER BY event_date"; //pulls all data from the venue table.
$resultVENUE = $mysqli->query($queryVENUE);
$eventsNameArray = array();
while ($rowEvents = $resultVENUE->fetch_assoc()) {
$eventsNameArray[] = $rowEvents['event_id'] . " " . $rowEvents['event_date'] . " " . $rowEvents['event_name'] . " " . $rowEvents['event_location'] . " " . $rowEvents['event_details'] . " " . "£" . $rowEvents['event_ticket_cost'] ;
}
foreach($eventsNameArray as $eventsOutput){
echo "<p>{$eventsOutput}</p>";
echo "<H3>Event Number: {$eventsOutput['event_id']}</H3>";
echo "<p>Event Date: {$eventsOutput['event_date']}</p>";
echo "<p>Event Name: {$eventsOutput['event_name']}</p>";
echo "<p>Event Location: {$eventsOutput['event_location']}</p>";
echo "<p>Event Details: {$eventsOutput['event_details']}</p>";
echo "<p>Event Ticket Cost: {$eventsOutput['event_ticket_cost']}</p>";
}
the output that I'm currently getting is this: 1 2013-11-21 Xscape Castleford Meet at the Hubs for 5pm. £5.00
Event Number: 1
Event Date: 1
Event Name: 1
Event Location: 1
Event Details: 1
Event Ticket Cost: £1
2 2013-11-24 Riding Rossendale Come ride at Rossendale in Manchester and get some practice in before the holiday! £5.00
Event Number: 2
Event Date: 2
Event Name: 2
Event Location: 2
Event Details: 2
Event Ticket Cost: 2
The aim to display the following: --row 1--
Event Number:
Event Date:
Event Location:
Event Details:
--row 2 --
Event Number:
Event Date:
Event Location:
Event Details:
Also i would like to put each section event number etc. into seperate Div's so i can style with css.
Thanks for any help in advance.
<div>'s goes, what have you tried? All you really need to do is just add more HTML as you like it, then just fill in the dynamic content into your HTML using PHP. So my suggestion is to build the HTML the way you want it first with hard-coded fake data, then you substitute the dynamic data once you have it the way you want it.