?
Solved

SQL/PHP output format

Posted on 2010-11-21
6
Medium Priority
?
707 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

 
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 2000 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

770 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