Solved

SQL/PHP output format

Posted on 2010-11-21
6
702 Views
Last Modified: 2012-05-10
I'm trying to make this output look like the picture attached. The colors and lines I can take care of, I just need help with the layout.

Here is my current code. I appreciate any help.
<?php
$sqlstr = mysql_query("SELECT * FROM Schedule WHERE `Schedule`.`Event` = ' ' ORDER BY `Schedule`.`Date` ASC");

echo "<p align='left'><font face='arial' size='15' color=yellow><i>2010</i></p>";


while($row=mysql_fetch_array($sqlstr)){

echo "</td>";
echo "<td width=110>";
echo $row['PointsAwarded'];
echo date('F l d', strtotime($row['Date']));
echo "</td><td width=485>";
echo $row['Place'];
echo "</td><td width=90>";
echo $row['StartTime'];
echo "</td><td>";
echo $row['Notes'];
echo "</td></tr>";
}

echo "</table>";

?>

Open in new window

Schedule-Idea.JPG
0
Comment
Question by:patrickm12981
  • 4
6 Comments
 
LVL 8

Expert Comment

by:agamal
ID: 34184851
I think if you can dump me the table from your sql so i can work on it better


also if you may attach the screen shot html code or file will be easier to guide you


i modified a little your code check below
Good Luck

<?php
##### i removed the condeition (WHERE `Schedule`.`Event` = ' ')
##### i found it useless untill i got a table dump from you
$sqlstr = mysql_query("SELECT * FROM Schedule ORDER BY `Schedule`.`Date` ASC");

echo "<p align='left'><font face='arial' size='15' color=yellow><i>2010</i></p>";
while($row=mysql_fetch_array($sqlstr)){

##### I commented one line and replaced it
##### with another to start the table
echo "<table><tr>";
//echo "</td>";

echo "<td width=110>";
echo $row['PointsAwarded'];
echo date('F l d', strtotime($row['Date']));
echo "</td><td width=485>";
echo $row['Place'];
echo "</td><td width=90>";
echo $row['StartTime'];
echo "</td><td>";
echo $row['Notes'];
echo "</td></tr>";

##### also i added the table closure to
#####the loop so each time you open a table and close it
echo "</table>";

}

?>

Open in new window

0
 
LVL 4

Expert Comment

by:betopa
ID: 34184852
Its easier with css.

Try one of these:

http://icant.co.uk/csstablegallery/
0
 

Author Comment

by:patrickm12981
ID: 34184901
Attached is a CSV of the table from the table and more of the page code. Thank you

<table border=1 align="center" width=930>

<tr>

<td><u>Date</u></td>
<td><u>Place</u></td>
<td><u>Start Time</u></td>
<td><u>Notes</u></td>
</tr>

<?php
$sqlstr = mysql_query("SELECT * FROM Schedule WHERE `Schedule`.`Event` = ' ' ORDER BY `Schedule`.`Date` ASC");

echo "<p align='left'><font face='arial' size='15' color=yellow><i>2010</i></p>";


while($row=mysql_fetch_array($sqlstr)){

echo "</td>";
echo "<td width=110>";
echo $row['PointsAwarded'];
echo date('F l d', strtotime($row['Date']));
echo "</td><td width=485>";
echo $row['Place'];
echo "</td><td width=90>";
echo $row['StartTime'];
echo "</td><td>";
echo $row['Notes'];
echo "</td></tr>";
}

echo "</table>";

?>

Open in new window

Schedule.csv
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 8

Expert Comment

by:agamal
ID: 34188153
it will be better to export as sql format
0
 
LVL 8

Expert Comment

by:agamal
ID: 34188209
or at least the table column headers
0
 
LVL 8

Accepted Solution

by:
agamal earned 500 total points
ID: 34189195
i think your code will make it look like one big table with all the results i believe you should device your select statement to be month based and then print table per each result

you can also check each result before posting the table of results if it is empty result you can skip or print "no plans" message



0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question