Hello!
The code below currently displays my data like this:
1 2 3
4 5 6
7 8 9
10 11 12
I'd like the data displayed like this (4 columns across):
1 4 7 10
2 5 8 11
3 6 9 12
Also this code was created to show the output fields like this:
city, state zip
company plantype
name
eventdate - eventtime
address
I want to change the order to:
name
eventdate - eventtime
address
city, state zip
company plantype
I can change the order but, what in the code determines the break between blocks of info?
Here's the code I have:
Thanks!
The code below currently displays my data like this:
1 2 3
4 5 6
7 8 9
10 11 12
I'd like the data displayed like this (4 columns across):
1 4 7 10
2 5 8 11
3 6 9 12
Also this code was created to show the output fields like this:
city, state zip
company plantype
name
eventdate - eventtime
address
I want to change the order to:
name
eventdate - eventtime
address
city, state zip
company plantype
I can change the order but, what in the code determines the break between blocks of info?
Here's the code I have:
Code:
<?php
$username="user";
$host="localhost";
$password="pwsd";
$database="mydatabase";
mysql_connect($host,$username,$password);
@mysql_select_db($database) or die("Unable to select database");
$query = "SELECT event.eventdate
, event.eventtime
, venue.name
, venue.address
, venue.city
, venue.state
, venue.zip
, companyplan.company
, companyplan.plantype
FROM event
INNER
JOIN venue
ON venue.venueid = event.eventplaceID
INNER
JOIN companyplan
ON companyplan.planid = event.eventplanID
ORDER
BY event.eventdate
, event.eventtime
, venue.city
, venue.state";
$result=mysql_query($query);
$plan = $city = $state = '';
$first = true;
?>
<style type="text/css">
body,div {padding:0; margin:0; line-height:1; font-family:Times New Roman, Times, serif; font-size:70%;}
#container{margin:0 auto; width:80%; background-color:#f1f1f1;overflow-y:hidden;}
.citystateplan{width: 25%; min-width: 250px; margin-right:40px; float:left;}
.name{color:#000000; font-weight: bold; font-size:12}
.city{color:#990000; font-weight: bold; font-size:12px;}
.plan{color:#000000; font-size:12px}
.date{color:#000000; font-size:12px}
.address{margin-bottom: 12px; color:#000000; font-size:12px}
</style>
<?php while ($row = mysql_fetch_array($result)): ?>
<div class="event">
<?php if ($plan !== $row['plantype'] || $state !==$row['state'] || $city !== $row['city']):
$plan = $row['state'];
$city = $row['city'];
$plan = $row['plantype'];
if (!$first) echo '</div>';
else $first = false;
?>
<div class="citystateplan">
<div class="city">
<?php echo $row['city']; ?>, <?php echo $row['state']; ?> <?php echo $row['zip']; ?>
</div>
<div class="plan">
<?php echo $row['company']; ?> <?php echo $plan; ?>
</div>
<?php endif; ?>
<div class="name"><?php echo $row['name']; ?></div>
<div class="date"><?php echo date("F j, Y ", strtotime($row['eventdate'])). " - " . date("g:i a ", strtotime($row['eventtime']));?></div>
<div class="address"><?php echo $row['address'];?></div>
</div>
<?php endwhile;?>
</div>
Thanks!