PDA

View Full Version : If clause Help Please!



captainjustin
01-07-2010, 07:19 PM
I'm trying to get this page to display the users phone number if its not set to private. I just can't seem to figure it out..... If anyone could help me out I would be very great full.... The code for my whole page is listed below.




<?



include("accesscontrol.php");



$q1 = "select * from members_info order by uname desc";

$r1 = mysql_query($q1) or die(mysql_error());





while($a1 = mysql_fetch_array($r1))

{

echo " <table align=center width=470 border=1 cellspacing=0 bordercolor=black class=BlackText>

<tr style=\"background-color:#990000; font-family:verdana; font-size:11; font-weight:bold; color:white\">\n\t<td width=120 align=center>$a1[fname] $a1[lname]</td>\n\t<td width=275 align=center>Members Details</td>\n\t<td width=75 align=center>Action</td></tr>

<tr style=\"background-color:#dddddd\">

<td align=left width=120><img src=\"http://$_SERVER[HTTP_HOST]$dir/member_image/$a1[image_id]\" alt=\"Members Photo\" width=\"120\" height=\"90\"></</td>

<td width=250><b><font color=#990000>User Name:</font></b>&nbsp;$a1[uname]<br>

<b><font color=#990000>Birthday:</font></b>&nbsp;$a1[bmonth]$a1[bday]<br>

<b><font color=#990000>Location:</font></b>&nbsp;$a1[city], $a1[state] $a1[country]<br>

<b><font color=#990000>Phone:</font></b>&nbsp;

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Ok here is where I'm having the problem


if ($a1[set_phone] < 1)

{
echo "$a1[phone2]";
}

else

{
echo "Set To Private";
}
{

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\





</td>









<td><a class=TNA href=member_mail.php?uname=$a1[uname]><center><img src=\"http://$_SERVER[HTTP_HOST]$dir/images/mail.gif\" alt=\"Members Photo\" width=\"16\" height=\"10\"><br>E-mail</center></a><br><a class=TNA href=view_user_post.php?uname=$a1[uname]><center><img src=\"http://$_SERVER[HTTP_HOST]$dir/images/search.gif\" alt=\"Members Photo\" width=\"16\" height=\"16\"><br>Posts</center></a></td>



</tr>









</tr>





</table>



<br>";

}



include("../footer.php");

?>

bluewalrus
01-07-2010, 09:35 PM
Maybe this?


<?



include("accesscontrol.php");



$q1 = "select * from members_info order by uname desc";

$r1 = mysql_query($q1) or die(mysql_error());





while($a1 = mysql_fetch_array($r1))

{
?>
<table align="center" width="470" border="1" cellspacing="0" bordercolor="black" class="BlackText">
<tr style="background-color:#990000; font-family:verdana; font-size:11; font-weight:bold; color:white">\
<td width="120" align="center"><?php echo $a1[fname] . $a1[lname];?></td>
<td width="275" align="center">Members Details</td>
<td width="75" align="center">Action</td></tr>
<tr style="background-color:#dddddd">
<td align="left" width="120"><img src="http://<?php echo $_SERVER['HTTP_HOST'] . $dir; ?>/member_image/<?php echo $a1[image_id];?>" alt="Members Photo" width="120" height="90"></</td>
<td width=250><span style="color=#990000; font-weight:bold;">User Name:</span> <?php echo $a1[uname];?><br />
<span style="color=#990000; font-weight:bold;">Birthday:</span> <?php echo ;$a1[bmonth]$a1[bday]?><br />
<span style="color=#990000; font-weight:bold;">Location:</span><?php echo $a1[city], $a1[state] $a1[country]?><br>
<span style="color=#990000; font-weight:bold;">Phone:</span> <?php

if ($a1[set_phone] < 1) {
echo "$a1[phone2]";
} else {
echo "Set To Private";
}
//{ <---- what is this opening? I dont see anything so I commented it out
?>
</td>
<td><a class="TNA" href="member_mail.php?uname=<?php echo $a1[uname];?>"><center><img src="http://<?php echo $_SERVER['HTTP_HOST'] . $dir; ?>/images/mail.gif" alt="Members Photo" width="16" height="10"><br>E-mail</center></a><br><a class=TNA href="view_user_post.php?uname=<?php echo $a1[uname];?>"><center><img src="http://<?php echo $_SERVER['HTTP_HOST'] . $dir; ?>/images/search.gif" alt="Members Photo" width="16" height="16"><br />Posts</center></a></td>
</tr>
</tr>
</table>
<br />";
<?php
} //this is closing your while loop I think you may have wanted it closed on line 38

include("../footer.php");

?>