Solved

SQL/PHP output format

Posted on 2010-11-21
6
701 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This video teaches users how to migrate an existing Wordpress website to a new domain.
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now