Solved

SQL/PHP output format

Posted on 2010-11-21
6
705 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

691 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