Link to home
Start Free TrialLog in
Avatar of Patrick Martin
Patrick MartinFlag for United States of America

asked on

SQL/PHP output format

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
Avatar of agamal
agamal
Flag of United Arab Emirates image

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

Its easier with css.

Try one of these:

http://icant.co.uk/csstablegallery/
Avatar of Patrick Martin

ASKER

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
it will be better to export as sql format
or at least the table column headers
ASKER CERTIFIED SOLUTION
Avatar of agamal
agamal
Flag of United Arab Emirates image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial