Results 1 to 2 of 2

Thread: If clause Help Please!

  1. #1
    Join Date
    Aug 2009
    Location
    Florida
    Posts
    23
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default If clause Help Please!

    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.

    PHP Code:

    <?



    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");

    ?>
    Last edited by Snookerman; 01-07-2010 at 08:33 PM.

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Maybe this?

    PHP Code:
    <?



    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");

    ?>
    Last edited by bluewalrus; 01-07-2010 at 10:59 PM.
    Corrections to my coding/thoughts welcome.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •