[dba-Tech] PhP

Peter Brawley peter.brawley at earthlink.net
Tue Sep 9 16:18:28 CDT 2008


John,

Try the ($var ? ifsothenthis : elsethis ) construction, something like 
this (untested) ...

echo "<tr><td width='200' valign='top' align='center'
      style='border-left-style:solid; border-left-width:0px;
      border-right-style:solid; border-right-width:0px; 
border-top-style:solid;
      border-top-width:0px; border-bottom-style:solid; 
border-bottom-width:1px'
      valign='top' height='30'><p align='center'><b>",
*      "<font size=",($row['MemberType']==6)?'2':'4',">",*
      $row["Name"],"</font></b><br><font size='1'";


John Bartow wrote:
> I didn't find an answer there. This is something I thought was pretty basic
> but I can't find anything by searching the net. I probably just don't know
> the PhP lingo well enough to look for it. I'm just starting to learn it and
> am pretty raw.
>
> All I want to do is to change the font to size 2 and not bold for each row
> where MemberTypeID = 6
>
> I thought I could remove the <b><font size='4'> from Line 98 and insert an
> If statement between line 98 and 99 such as: 
> if (MemberTypeID = 6)
> {echo( "<font size='2'> " .}
> else
> {echo( "<b><font size='4'> " .}
>
> Page code: (I added the line numbers for reference)
> ----------------------------------------
>   1. <table border="0" cellspacing="0" cellpadding="0">
>   2. 	<tr>
>   3. 		<td width="180" height="95" valign="top"><a
> href="../index.html">
>   4. 		<img border="0" src="../images/logo.png" alt="Go To Home
> Page" width="180" height="81" align="top"></a>
>   5. 		</td>
>   6. 		<td align="center" width="720">
>   7. 		<p align="center">
>   8. 		<img border="0" src="../images/banner.png" align="center"
> width="463" height="60">
>   9. 		</p>
>  10. 		</td>
>  11. 	</tr>
>  12. 	<tr>
>  13. 		<td width="180" bordercolor="#000000"> </td>
>  14. 		<td width="720" align="left"
> bordercolor="#000000"> </td>
>  15. 	</tr>
>  16. </table>
>  17. <tr>
>  18. <td width="200" valign="top" rowspan="5" align="center">
>  19. <table border="0" id="table3" width="800">
>  20. 	<tr>
>  21. 		<td align="center" rowspan="2" width="180"
> valign="top"> <p>Bla Bla 
>  22. 		Bla</td>
>  23. 		<td align="center" rowspan="2" width="10"
> valign="top"> </td>
>  24. 	</tr>
>  25. 	</td>
>  26. 	<tr>
>  27. 		<td valign="top">
>  28. 		<h3 align="center">
>  29. 		<img border="0" src="images/main.png" width="494"
> height="54"></h3>
>  30. 		<p></p>
>  31. 		<h2 style="text-align: center">Members</h2>
>  32. 		<?php
>  33. $username="clubdupe";
>  34. $password="9vTnB4WCQQ7c";
>  35. $database="club_members";
>  36. // Connect to the database server
>  37. $dbcnx = @mysql_connect("localhost",$username, $password);
>  38. if (!$dbcnx)
>  39. 	{
>  40. 	echo( "<P>Unable to connect to the " .          
>  41. 	"database server at this time.</P>" );
>  42. 	exit();
>  43. 	}
>  44.   // Select the database
>  45. if (! @mysql_select_db($database) )
>  46. 	{
>  47. 	echo( "<P>Unable to locate the " .
>  48. 	"database at this time.</P>" );
>  49. 	exit();
>  50. 	}
>  51. ?> <?php
>  52. // Request a list of members
>  53. $result = mysql_query("SELECT 
>  54. MemberType.MemberType, 
>  55. Business.Name, 
>  56. Business.Contact, 
>  57. Business.PhysicalAddress, 
>  58. Business.MailAddress, 
>  59. Business.City, 
>  60. Business.State, 
>  61. Business.Zip, 
>  62. Business.Telephone, 
>  63. Business.Fax, 
>  64. Business.EmailAddress, 
>  65. Business.Website 
>  66. FROM MemberType 
>  67. INNER JOIN Business ON MemberType.MemberTypeID = Business.MemberTypeID 
>  68. ORDER BY Business.Name;");
>  69. if (!$result)
>  70. 	{
>  71. 	echo("<P>Error performing query: " .
>  72. 	mysql_error() . "</P>");
>  73. 	exit();
>  74. 	}
>  75. // Display the text of each row in a table cell
>  76. ?>
>  77. 		<div align="center">
>  78. 			<table border="0" width="800" id="table1">
>  79. 				<tr>
>  80. 					<td width="200" valign="top"
> align="center" style="border-left-style:solid; border-left-width:0px;
> border-right-style:solid; border-right-width:0px; border-top-style:solid;
> border-top-width:0px; border-bottom-style:solid; border-bottom-width:1px"
> height="30">
>  81. 					<p><u>
>  82. 					<span
> style="mso-bidi-font-size:10.0pt; font-weight:700">
>  83. 					 </span><span
> style="font-weight: 700">Business 
>  84. 					Name</span></u></p>
>  85. 					</td>
>  86. 					<td width="200" valign="top"
> align="center" style="border-left-style:solid; border-left-width:0px;
> border-right-style:solid; border-right-width:0px; border-top-style:solid;
> border-top-width:0px; border-bottom-style:solid; border-bottom-width:1px"
> valign="top" height="30">
>  87. 					<p align="left"><u><b>Contact
> Address</b></u></p>
>  88. 					</td>
>  89. 					<td width="200" valign="top"
> align="center" style="border-left-style:solid; border-left-width:0px;
> border-right-style:solid; border-right-width:0px; border-top-style:solid;
> border-top-width:0px; border-bottom-style:solid; border-bottom-width:1px"
> valign="top" height="30">
>  90. 					<u><span
> style="mso-bidi-font-size:10.0pt; font-weight:700">
>  91. 					 </span><span
> style="font-weight: 700">Phone/Fax</span></u></td>
>  92. 					<td width="200" valign="top"
> align="center" style="border-left-style:solid; border-left-width:0px;
> border-right-style:solid; border-right-width:0px; border-top-style:solid;
> border-top-width:0px; border-bottom-style:solid; border-bottom-width:1px"
> valign="top" height="30">
>  93. 					<u><span style="font-weight:
> 700">Internet Info</span><span style="mso-tab-count: 1; font-weight:700">
> </span></u></td>
>  94. 				</tr>
>  95. <?php
>  96. while ( $row = mysql_fetch_array($result) )
>  97. 	{
>  98. 	echo( "<tr><td width='200' valign='top' align='center'
> style='border-left-style:solid; border-left-width:0px;
> border-right-style:solid; border-right-width:0px; border-top-style:solid;
> border-top-width:0px; border-bottom-style:solid; border-bottom-width:1px'
> valign='top' height='30'><p align='center'><b><font size='4'>" .
>  99. 	$row["Name"] . "</font></b><br><font size='1'");
> 100. 	echo( "<br>" .
> 101. 	$row["MemberType"] . "</font>");
> 102. 	echo( "</td><td width='200' valign='top' align='center'
> style='border-left-style:solid; border-left-width:0px;
> border-right-style:solid; border-right-width:0px; border-top-style:solid;
> border-top-width:0px; border-bottom-style:solid; border-bottom-width:1px'
> valign='top' height='30'><p align='left'><font size='2'>" .
> 103. 	$row["Contact"] . "");
> 104. 	echo( "<br>" .
> 105. 	$row["PhysicalAddress"] . "");
> 106. 	echo( "<br>" .
> 107. 	$row["MailAddress"] . "");
> 108. 	echo( "<br>" .
> 109. 	$row["City"] . " ");
> 110. 	echo( "" .
> 111. 	$row["State"] . " ");
> 112. 	echo( "" .
> 113. 	$row["Zip"] . "");
> 114. 	echo( "</td><td width='200' valign='top' align='center'
> style='border-left-style:solid; border-left-width:0px;
> border-right-style:solid; border-right-width:0px; border-top-style:solid;
> border-top-width:0px; border-bottom-style:solid; border-bottom-width:1px'
> valign='top' height='30'><p align='center'><font size='2'>" .
> 115. 	$row["Telephone"] . " ");
> 116. 	echo( "<br>" .	
> 117. 	$row["Fax"] . " ");
> 118. 	echo( "</td><td width='200' valign='top' align='center'
> style='border-left-style:solid; border-left-width:0px;
> border-right-style:solid; border-right-width:0px; border-top-style:solid;
> border-top-width:0px; border-bottom-style:solid; border-bottom-width:1px'
> valign='top' height='30'><p align='center'><font size='2'>" .
> 119. 	$row["EmailAddress"] . " ");
> 120. 	echo( "<br>" .
> 121. 	$row["Website"] . "</td></tr></font>");
> 122. 	}
> 123. ?>
> 124. 			</table>
> 125. 		</div>
> ----------------------------------------
>
>
> TIA
> John B
>
> _______________________________________________
> dba-Tech mailing list
> dba-Tech at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-tech
> Website: http://www.databaseadvisors.com
> ------------------------------------------------------------------------
>
>
> Internal Virus Database is out of date.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.169 / Virus Database: 270.6.16/1651 - Release Date: 9/4/2008 6:57 AM
>
>   



More information about the dba-Tech mailing list