Page 1 of 1

Layout not looking right

Posted: Wed Aug 14, 2002 10:53 pm
by dinno2
Well i have PHP reading the database fine, its just the appearance im not happy with, i would like to be able to <center> the text, and font size arial 1 .. the page in question is at:
http://www.kunzair.com/searchform.php?p ... ael+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>

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

is that possible??!!??
Michael

Posted: Wed Aug 14, 2002 11:05 pm
by protokol
You need to be more specific about what part of the page you need help formatting.

The sql data

Posted: Wed Aug 14, 2002 11:12 pm
by dinno2
The Data being pulled off the database, it is writing to the page fine, but i think it looks sloppy, if you take a look at the first link below, it will show you what i am getting, the second link is what i would like to have the page look like. basically, the text size, and font, in a php querry.
the code is in the first post still. hope that clears that up?
Michael
now:
http://www.kunzair.com/searchform.php?p ... ael+Driggs
what i would like aperance wise:
http://www.kunzair.com/kva101.htm

thanks

Posted: Wed Aug 14, 2002 11:14 pm
by protokol
Just edit the html attributes in the php code. So where there is a <tr>, make it <tr align=\"center\">

Then everything in the row is centered.

Posted: Wed Aug 14, 2002 11:22 pm
by dinno2
Thanks ill try that, what about font size? and style
hehe sorry to be a pest <G>
Michael

Posted: Wed Aug 14, 2002 11:29 pm
by protokol
Think of all the data you are displaying as just plain text. Don't worry about the fact that it is dynamically displayed. If you have a pilot who you are displaying info for, then print the formatting (tables in your case) just as you would do in HTML. Create a stylesheet and then include the class's or id's in your HTML.

CSS Tutorial

Posted: Wed Aug 14, 2002 11:50 pm
by dinno2
im sorry i just dont get that, ive been reading for two weeks, and cant find anything on text size, in php array
i still am learning <G> duh, and i sure apreciate your help, i did get the text centered, just would like to know anyway to change the text size, per LINE...such as the <TR> or <TD> tags?

Posted: Wed Aug 14, 2002 11:59 pm
by phice
<font face=Arial size=1>$variableName</font>

Easy. :/

Posted: Thu Aug 15, 2002 12:04 am
by dinno2
wow, and ive been looking for weeks for that...shhesh

thank you so much!

Michael

Posted: Thu Aug 15, 2002 1:50 am
by twigletmac
<css advocacy>The problem with <font> tags is you end up with hundreds of them bloating your page. If you really want more control over which fonts are used and what they should look like, try CSS like protokol said. It really makes a difference to page size and by using it you can change all your text to Verdana without having to worry about every little font tag.</css advocacy> :)

Mac

Posted: Thu Aug 15, 2002 8:02 am
by MattF
the <font> tag is HTML not PHP.

If you want to save page loading times and produce a better page add this between the head tags:

<style type="text/css">
.cell {
font-family: Arial;
font-size: 10pt;
text-align: center;
}
</style>

Then when you echo out each line change <td> to <td class="cell">