Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Row Result font Size

Status
Not open for further replies.

mrliam69

Programmer
Jul 21, 2003
75
0
0
GB
Wonder if anyone can help a HTML / PHP Newbie

How can you change the row result font and size ?



---------------------------------------------------------
Code:
$msresults= mssql_query($msquery);

				$i = 0;

				while ($row = mssql_fetch_array($msresults)) 
					{if ($i > 0) {	print "<tr valign='bottom'>";
									print "<td bgcolor='#ffffff' height='1' style='background-image:url(img/strichel.gif)' colspan='6'></td>";
									print "</tr>";}
									
					print "<tr valign='middle'>";
					print "<td class='tabval'><img src='img/blank.gif' alt='' width='10' height='20'></td>";
					print "<td class='tabval'><b>".$row['AccountName']."</b></td>";
					print "<td class='tabval'><b>".$row['VehReg']."</b></td>";
					print "<td class='tabval'>".$row['VehMakeModel']."&nbsp;</td>";
					print "<td class='tabval'>".date("l jS F Y", strtotime($row['NextServiceDate']))."&nbsp;</td>";
					print "<td class='tabval'></td>";
					print "</tr>";
					$i++;
				}
--------------------------------------------------------
 
Since the font and size is controled through html or CSS, all you have to do is output the proper html, or css to achieve the result
In your case add font-size and font-familt to your css class
tabval.

Code:
.tabval{
font-size:16px;
font-family:Arial;

}

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Cheers for that but I Found the answer

Code:
print "<td style=\"font-family:arial;font-size: 12px;\"><b>".$row['AccountName']."</b></td>";
 
Its the same thing, but i don;t recommend applying an inline style to something that already had a Style class assigend to it. You are overrriding whatver assignments you gave to the row via the <td class='tabval'>.

Why not add that inline style to the class style?

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Seeing as I am learning PHP HTML etc... by my usual method of reverse engineering where would I put the above style please


Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]
<html>
	<head>
 
		<title></title>
	</head>
			<table width="500" cellpadding="0" cellspacing="0" border="0" id="table2">
				<tr>
					<td align="left" width="480">&nbsp;</td>
				</tr>
				<tr>
					<td align="left" width="480"><input type="text" name="value" size="40"></td>
				</tr>
				<tr>
					<td align="left" width="480">&nbsp;</td>
				</tr>
				<tr>
					<td align="left" width="480"><input type="submit"> * <input type="reset"></td>
				</tr>
			</table>
<table border="0" cellpadding="0" cellspacing="0" id="table1">
<tbody>

<tr bgcolor="#f87820">
	<td><font face="arial" size="1"><img src="img/blank.gif" alt="" width="20" height="25" /></font></td>
	<td width="150"><font face="arial" size="1">
	<img src="img/blank.gif" alt="" width="100" height="6" /><br /><b></style>
		<?php print $row['VehReg']?>
			</b></font></td>
	<td width="100"><font face="arial" size="1">
	<img src="img/blank.gif" alt="" width="100" height="6" /><br /><b>
		<?php print $row['nextservicedate']?>
			</b></font></td>
	<td><font face="arial" size="1">
	<img src="img/blank.gif" alt="" width="100" height="6" /><br /><b>
		<?php print $row['dateinservice']?>
			</b></font></td>
	<td><font face="arial" size="1">
	<img src="img/blank.gif" alt="" width="50" height="6" /><br /><b>
		<?php print $row['vehicleidentification']?>
			</b></font></td>
	<td></td>
</tr>


<?
$msconnect=mssql_connect("tezzer-xp32\sqltezzer","sa","tezzer");
$msdb=mssql_select_db("tezzer",$msconnect);
$msquery = "SELECT TOP (100) PERCENT upper(dbo.TBL_Vehicles.VehReg) as VehReg, dbo.TBL_Vehicles.VehMakeModel, dbo.TBL_Vehicles.VehLastKnownServiceDate, 
                   dbo.TBL_Vehicles.VehServiceFrequency, dbo.TBL_Vehicles.VehServiceFrequencyUnit, 
                   CASE vehservicefrequencyunit WHEN 'daily' THEN CASE WHEN vehlastknownservicedate < CONVERT(varchar(30), getdate(), 101) THEN dateadd(day, 
                   (ceiling(abs((datediff(day, vehlastknownservicedate, CONVERT(varchar(30), getdate(), 101))) / (vehservicefrequency * 1.0))) * vehservicefrequency), 
                   vehlastknownservicedate) ELSE vehlastknownservicedate END WHEN 'weekly' THEN CASE WHEN vehlastknownservicedate < CONVERT(varchar(30), 
                   getdate(), 101) THEN dateadd(week, (ceiling(abs((datediff(week, vehlastknownservicedate, CONVERT(varchar(30), getdate(), 101))) 
                   / (vehservicefrequency * 1.0))) * vehservicefrequency), vehlastknownservicedate) 
                   ELSE vehlastknownservicedate END WHEN 'monthly' THEN CASE WHEN vehlastknownservicedate < CONVERT(varchar(30), getdate(), 101) 
                   THEN dateadd(month, (ceiling(abs((datediff(month, vehlastknownservicedate, CONVERT(varchar(30), getdate(), 101))) / (vehservicefrequency * 1.0))) 
                   * vehservicefrequency), vehlastknownservicedate) 
                   ELSE vehlastknownservicedate END WHEN 'yearly' THEN CASE WHEN vehlastknownservicedate < CONVERT(varchar(30), getdate(), 101) 
                   THEN dateadd(year, (ceiling(abs((datediff(week, vehlastknownservicedate, CONVERT(varchar(30), getdate(), 101))) / (vehservicefrequency * 1.0))) 
                   * vehservicefrequency), vehlastknownservicedate) ELSE vehlastknownservicedate END ELSE '01/01/1900' END AS nextservicedate, 
                   dbo.TBL_Accounts.AccountName
			FROM dbo.TBL_Vehicles 
			INNER JOIN dbo.TBL_Accounts 
			ON dbo.TBL_Vehicles.VehAccountNumber = dbo.TBL_Accounts.AccountNumber
			order by nextservicedate, dbo.TBL_Vehicles.VehAccountNumber, dbo.TBL_Vehicles.VehReg
 
";
$msresults= mssql_query($msquery);

                $i = 0;

                while ($row = mssql_fetch_array($msresults)) 
                    {if ($i > 0) {    print "<tr valign='bottom'>";
                                    print "<td bgcolor='#ffffff' height='1' style='background-image:url(img/strichel.gif)' colspan='6'></td>";
                                    print "</tr>";}
                                    
                    print "<tr valign='middle'>";
                    print "<td style=\"font-family:arial;font-size: 12px;\"><img src='img/blank.gif' alt='' width='10' height='16'></td>";
                    echo "<td style=\"font-family:arial;font-size: 12px;\"><b>".$row['AccountName']."</b></td>";
                    echo "<td style=\"font-family:arial;font-size: 12px;\"><b>".$row['VehReg']."<br>\n </td>"; 
                    echo "<td style=\"font-family:arial;font-size: 12px;\">".$row['VehMakeModel']."<br>\n </td>"; 
                    echo "<td style=\"font-family:arial;font-size: 12px;\"><b>".date("l jS F Y", strtotime($row['nextservicedate']))."</b></td>";
                    print "</tr>";
                    $i++;
                }
				print "<tr valign='bottom'>";
				print "<td bgcolor='#fb7922' colspan='6'><img src='img/blank.gif' alt='' width='1' height='8'></td>";
				print "</tr>";
			?> 
			</tbody></table>
 
It seems you changed the code... in the first snippet of code you posted:
Code:
$msresults= mssql_query($msquery);

                $i = 0;

                while ($row = mssql_fetch_array($msresults))
                    {if ($i > 0) {    print "<tr valign='bottom'>";
                                    print "<td bgcolor='#ffffff' height='1' style='background-image:url(img/strichel.gif)' colspan='6'></td>";
                                    print "</tr>";}
                                    
                    print "<tr valign='middle'>";
                    print "<td [red]class='tabval[/red]'><img src='img/blank.gif' alt='' width='10' height='20'></td>";
                    print "<td class='tabval'><b>".$row['AccountName']."</b></td>";
                    print "<td class='tabval'><b>".$row['VehReg']."</b></td>";
                    print "<td class='tabval'>".$row['VehMakeModel']."&nbsp;</td>";
                    print "<td class='tabval'>".date("l jS F Y", strtotime($row['NextServiceDate']))."&nbsp;</td>";
                    print "<td class='tabval'></td>";
                    print "</tr>";
                    $i++;
                }

You had set a class for the <td>'s or the table rows named [green]'tabval'[/green]. in the new code you no longer have it. So if you are not going to use the classes, then the inline CSS is o.k. if you are using the classes, then put the font-faimily and font-size attributes wherever it is you are defining the class [green]'tabval'[/green]. Usually an external stylesheet or a <style> block in the same document.




----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top