problem in geeting the values according to the needs

Discussion in 'PHP' started by parmindersodhi, Dec 10, 2012.

  1. #1
    This is my code i have a table user_access in that it contains 3 coloumns user_id, access and budget code i want to work with access and user_id.
    please give any suggestions as i am not getting it in the right way. thankyou

    <?php
    require_once('auth.php');
    require_once('connection.php');

    $user_id=$_SESSION['SESS_USER_ID'];
    $query=mysql_query("SELECT DISTINCT access FROM user_access WHERE user_id=$user_id") or die(mysql_error());

    ($rows=mysql_fetch_array($query));
    $access1= $rows['access']=='entry';
    $con1= $rows['access']=='approver1' && $rows['access']=='approver2';
    $con2= $rows['access']=='approver2'&& $rows['access']=='approver3';
    $con3= $rows['access']=='approver3'&& $rows['access']=='approver1';
    $con4= $rows['access']=='approver1'&& $rows['access']=='approver2' && $rows['access']=='approver3';

    if
    ($access1){
    echo '<tr>
    <td width="30%" align="right"><label>
    <input type=\'radio\' name=\'selection\' value=\'\' id=\'selection_0\' onClick="location.href=\'status.php\'" />
    </label></td>
    <td width="70%" align="left">Enter Spend Request</td>
    </tr>
    <tr>
    <td width="30%" align="right"><label>
    <input type=\'radio\' name=\'selection\' value=\'\' id=\'selection_0\' onClick="location.href=\'delete-resubmit.php\'"/>
    </label></td>
    <td width="70%" align="left" >Delete/Resubmit Spend Request</td>
    </tr>';

    }

    else if ($con1) {

    echo '<tr>
    <td width="30%" align="right"><label>
    <input type=\'radio\' name=\'selection\' value=\'\' id=\'selection_0\' onClick="location.href=\'app1.php\'" />
    </label></td>
    <td width="70%" align="left">Approver 1</td>
    </tr>

    <tr>
    <td width="30%" align="right"><label>
    <input type=\'radio\' name=\'selection\' value=\'\' id=\'selection_0\' onClick="location.href=\'app3.php\'" />
    </label></td>
    <td width="70%" align="left">Approver 3</td>
    </tr>';


    }


    else if ($con2){
    echo '<tr>
    <td width="30%" align="right"><label>
    <input type=\'radio\' name=\'selection\' value=\'\' id=\'selection_0\' onClick="location.href=\'app1.php\'" />
    </label></td>
    <td width="70%" align="left">Approver 1</td>
    </tr>
    <tr>
    <td width="30%" align="right"><label>
    <input type=\'radio\' name=\'selection\' value=\'\' id=\'selection_0\' onClick="location.href=\'app2.php\'" />
    </label></td>
    <td width="70%" align="left">Approver 2</td>
    </tr>';

    }
    else if ($con3){
    echo '<tr>
    <td width="30%" align="right"><label>
    <input type=\'radio\' name=\'selection\' value=\'\' id=\'selection_0\' onClick="location.href=\'app2.php\'" />
    </label></td>
    <td width="70%" align="left">Approver 2</td>
    </tr>
    <td width="30%" align="right"><label>
    <input type=\'radio\' name=\'selection\' value=\'\' id=\'selection_0\' onClick="location.href=\'app3.php\'" />
    </label></td>
    <td width="70%" align="left">Approver 3</td>
    </tr>';

    }
    else if ($con4){
    echo '<tr>
    <td width="30%" align="right"><label>
    <input type=\'radio\' name=\'selection\' value=\'\' id=\'selection_0\' onClick="location.href=\'app1.php\'" />
    </label></td>
    <td width="70%" align="left">Approver 1</td>
    </tr>
    <td width="30%" align="right"><label>
    <input type=\'radio\' name=\'selection\' value=\'\' id=\'selection_0\' onClick="location.href=\'app2.php\'" />
    </label></td>
    <td width="70%" align="left">Approver 2</td>
    </tr>
    <td width="30%" align="right"><label>
    <input type=\'radio\' name=\'selection\' value=\'\' id=\'selection_0\' onClick="location.href=\'app3.php\'" />
    </label></td>
    <td width="70%" align="left">Approver 3</td>
    </tr>';

    } ;


    ?>
     
    parmindersodhi, Dec 10, 2012 IP
  2. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #2
    "i am not getting it in the right way" doesn't tell us anything. What do you want to get and what are you getting?
     
    Rukbat, Dec 11, 2012 IP