PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
3.14
Forum Commoner
Posts: 28 Joined: Mon Sep 08, 2003 12:17 am
Post
by 3.14 » Wed Sep 17, 2003 11:02 pm
This bit of code works fine and displays in the normal ordinary boring times new roman font.. eeeugh!
Code: Select all
<?php
<td><?= $line['FirstName'] ?></td>
?>
Then I try this to change the font to arial and...
Code: Select all
<?php
<td><?= $line['<font face="Arial">LastName</font>'] ?></td>
?>
The column doesn't show up.
Even trying this
Code: Select all
<?php
<td><?= $line["<font face="Arial">'EmployeeID'</font>"] ?></td>
?>
Doesn't seem to work either. What am I doing wrong? Is hating default fonts that bad a crime against humanity that it won't let me change it?
scorphus
Forum Regular
Posts: 589 Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:
Post
by scorphus » Wed Sep 17, 2003 11:27 pm
Hi,
Could you please post the content of this $line array? Do:
and let us see what your array is like.
Regards,
Scorphus.
3.14
Forum Commoner
Posts: 28 Joined: Mon Sep 08, 2003 12:17 am
Post
by 3.14 » Wed Sep 17, 2003 11:42 pm
Ok, well the statement looks like this:
Code: Select all
<?php
while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
{
?>
The output... with fake data is as follows:
Array ( [EmployeeID] => 1 [FirstName] => Frank [LastName] => Barns [Address] => 175 Kumble Way [Suburb] => Hilsdale [State] => WA [Postcode] => 6135 [Phone] => (08) 9247 7492 [StartDate] => 2001-04-10 [EndDate] => 0000-00-00 )
Of course that's just one element... all the others are identical in format.
scorphus
Forum Regular
Posts: 589 Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:
Post
by scorphus » Wed Sep 17, 2003 11:55 pm
Thanks
When you do:
Code: Select all
<td><?= $line['<font face="Arial">LastName</font>'] ?></td>
you're trying to get an invalid position of $line array ('<font face=\"Arial\">LastName</font>'). I would say you should change it to:
Code: Select all
<td><font face="Arial"><?= $line['LastName'] ?></font></td>
Now PHP can read the position 'LastName' of %line array and place it inside the <font></font> tag.
Or if you want PHP to print the <font> tag, we say:
Code: Select all
<td><?= '<font face="Arial">' . $line['LastName'] . '</font>' ?></td>
Hope it helps a bit...
Cheers,
Scorphus.
3.14
Forum Commoner
Posts: 28 Joined: Mon Sep 08, 2003 12:17 am
Post
by 3.14 » Thu Sep 18, 2003 12:02 am
Worked like a charm. Thanks
I'm surprised I missed the first option. The second option is something new though, so thanks for that.
McGruff
DevNet Master
Posts: 2893 Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland
Post
by McGruff » Thu Sep 18, 2003 12:27 am
Font tag is deprecated: better to use CSS styles, eg:
<body style="font-family: arial, sans-serif;">