PDA

View Full Version : Layout


MichaelD
08-15-2002, 04:02 AM
I have the database reading and writing to a php page fine, just having problems with the layout, can any help? or point me somewhere that can help?
the page in question is
http://www.kunzair.com/searchform.php?pilotid=KVA101-+Michael+Driggs

the code is

<html>
<body>
<?php

mysql_connect (localhost, kunzair_Michael, poster1);

mysql_select_db (kunzair_pirep);
include("header.php");
if ($pilotid == "")
{$pilotid = '%';}

$result = mysql_query ("SELECT * FROM pirep WHERE pilotid LIKE '$pilotid%'");

if ($row = mysql_fetch_array($result)) {
print "<CENTER>";
print "
<table>
<TD>{$row['pilotid']}</TD>\n";
print "<br><br>";
print "<TABLE BORDER=\"0\">\n";
print "<TR>\n<TD><b>PilotID_________________</b></TD>\n";
print "<hr>";
print "<TD><b>Departure___</b></TD>\n";
print "<TD><b>Destination__</b></TD>\n";
print "<TD><b>Hours__</b></TD>\n";
print "<TD><b>Route</b></TD>\n</TR>\n";
do {
print "<TR>\n";
print "<TD>{$row['pilotid']}</TD>\n";
print "<TD>{$row['departure']}</TD>\n";
print "<TD>{$row['destination']}</TD>\n";
print "<TD>{$row['hours']}</TD>\n";
print "<TD>{$row['route']}</TD>\n";
print "</TR>\n";
} while($row = mysql_fetch_array($result));
print "</TABLE>\n</CENTER\n";
print "<center>";
print "<br><br>";
print "<br><br>";
} else {print "<center>You need to enter a PIREP first!</center>";}
print "<BR>\n";
include("footer2.php");
?>
</body>



..........................................................................

what i would like it to look like is :
http://www.kunzair.com/kva101.htm

possible? using php?

Thanks
Michael

Ökii
08-15-2002, 02:07 PM
Your only snags are in the formatting and syntax of the HTML.

I'd suggest trying to learn the syntaxes yourself --- an easy way would be just to view source on both pages you linked and play a swift game of spot the difference....
Then just look through the PHP script for the do{} while() section and amend the print statements.

An example for the departure <td> output

your php script says -
print "<TD>{$row['departure']}</TD>\n";
your other page source reads
<td width="144" align="center"><font face="Arial" size="1">KBUR</font></td>

quite simple to just work out what additional bits need to be put in the print statement
print '<td width="144" align="center"><font face="Arial" size="1">'.$row["departure"].'</font></td>
';
should do for that bit.

Anyway - have a go yourself and just view-source on the output page to check whether the HTML looks well formed.

PS. Welcome to the forum :)