Solved

SQL/PHP output format

Posted on 2010-11-21
6
698 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

744 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

14 Experts available now in Live!

Get 1:1 Help Now