1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Rep Power

    If Then Statement In a query output

    I have this code:

    Query Stuff here then

    <td width="20" align="left">
    <input type="checkbox" checked name="Employee_ID" value="[ PHP] echo $row->ID[ /PHP]"/>

    <td class="crewlist_cell">
    <a href="employee_detail.php?[ PHP] echo ID ?>=[ PHP] echo $row->ID;[ /PHP]" >

    [ PHP] echo $row->Name_FirstLast;

    echo '</a></td>
    <td class="crewlist_time">------Here --------</td></tr>'[ /PHP]

    Anyway where it says -----Here -------- I want the display to show 8:00 for all ID's except if the ID is 11 and if its 11 then I want it to show 9:15.

    So it would be if ID =11 then show 9:15 else 8:00.

    Anyway I cant seem to get it to work
  2. #2
  3. No Profile Picture
    Super Moderator
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2009
    Hartford, WI
    Rep Power
    Have you attempted any If/Then yet with this setup? A simple If/Then with desired values make this extremely basic. Perhaps set a variable with your items like:

    PHP Code:
    if($id == 11) {
    $time "9:15";
    } else {
    $time "8:00";

    Or a simple shorthand version:

    PHP Code:
    $time = ($id == 11 "9:15" "8:00"); 
    You may even attempt to slip the shorthand version directly into your echo. Whatever works best for ya. Good luck!

IMN logo majestic logo threadwatch logo seochat tools logo