Selecting Users with Option Tag

Results 1 to 9 of 9
  1. #1
    Alpha Member Glee is offline
    MemberRank
    Jun 2009 Join Date
    Niagara Falls,Location
    2,225Posts

    Selecting Users with Option Tag

    Hey Y'all,

    It's been awhile since I posted here, I'm starting to get back into Retro world again. I'm trying to create myself a little report tool with RevCMS I'm trying to use the option tag and selecting users with rank 3 or higher.

    this is what I have so far

    PHP Code:
    <!DOCTYPE html>
    <html lang="en">
    <?php
    $getStaff 
    mysql_query("SELECT `username` FROM `users` WHERE `rank` >= '3'");
     while(
    $staffUser mysql_fetch_array($getStaff)){
         echo 
    '
         <select name="report_staff" class="form-control">
        <option value="NA">N\A</option>
        <option disabled>-------------------------</option>
         <tr>
         <a href="{url}/home/'
    .$staffUser['username'].'">
         </tr>'
     
    }
     
    ?>
    But it just breaks my test page basically making it all white


  2. #2
    Member Aamiainen is offline
    MemberRank
    Aug 2016 Join Date
    FinlandLocation
    83Posts

    Re: Selecting Users with Option Tag

    Code:
    <?php
    ini_set('display_errors',1);
    ini_set('display_startup_errors',1);
    error_reporting(E_ALL);
    ??


    Put that in the beginning of your file and it should show you whats erroring.

    also i think it should be mysql_fetch_assoc not mysql_fetch_array.

  3. #3
    Alpha Member Glee is offline
    MemberRank
    Jun 2009 Join Date
    Niagara Falls,Location
    2,225Posts

    Re: Selecting Users with Option Tag

    Quote Originally Posted by Aamiainen View Post
    Code:
    <?php
    ini_set('display_errors',1);
    ini_set('display_startup_errors',1);
    error_reporting(E_ALL);
    ??


    Put that in the beginning of your file and it should show you whats erroring.

    also i think it should be mysql_fetch_assoc not mysql_fetch_array.
    Even with that code it's still showing up blink

  4. #4
    Member Aamiainen is offline
    MemberRank
    Aug 2016 Join Date
    FinlandLocation
    83Posts

    Re: Selecting Users with Option Tag

    Quote Originally Posted by Glee View Post
    Even with that code it's still showing up blink
    you're missing ";" mark after your echo.

  5. #5
    Alpha Member Glee is offline
    MemberRank
    Jun 2009 Join Date
    Niagara Falls,Location
    2,225Posts

    Re: Selecting Users with Option Tag

    Quote Originally Posted by Aamiainen View Post
    you're missing ";" mark after your echo.
    even with the ";" it's still breaking it! This is the new code

    PHP Code:
    <?php

    $getStaff 
    mysql_query("SELECT username FROM users WHERE `rank` <= '10'");
     while(
    $staffUser mysql_fetch_assoc($getStaff)){
         echo
    '
         <select name="report_staff" class="form-control">
        <option value="NA">N\A</option>
        <option disabled>-------------------------</option>
         '
    .$staffUser['username'].'"';
     }
     
    ?>

  6. #6
    Member Aamiainen is offline
    MemberRank
    Aug 2016 Join Date
    FinlandLocation
    83Posts

    Re: Selecting Users with Option Tag

    idk then, if you can't get any errors to show up then it's just guessing.

    Is that all the code on your file or is there something before/after that too?

    You propably tried already but see if your query returns any rows through phpmyadmin/navicat/whatever. Also for future problems i recommend using https://phpcodechecker.com or some other code validation tool.

  7. #7
    Alpha Member Glee is offline
    MemberRank
    Jun 2009 Join Date
    Niagara Falls,Location
    2,225Posts

    Re: Selecting Users with Option Tag

    Quote Originally Posted by Aamiainen View Post
    idk then, if you can't get any errors to show up then it's just guessing.

    Is that all the code on your file or is there something before/after that too?

    You propably tried already but see if your query returns any rows through phpmyadmin/navicat/whatever. Also for future problems i recommend using https://phpcodechecker.com or some other code validation tool.
    I think I fixed it but now it's not selecting my name?

    PHP Code:
    <?php
    $getStaff 
    mysql_query("SELECT username FROM users WHERE rank >= '3'");
     while(
    $staffUser mysql_fetch_array($getStaff)){
        echo
    '
        <option value="NA">N\A</option>
        <option disabled>-------------------------</option>
        '
    .$staffUser['username'].'"';
    }
    ?>
    I think >= means greater so anything that is higher then rank 3 right? Because I'm rank 11 in my system

  8. #8
    Check http://arcturus.pw The General is offline
    DeveloperRank
    Aug 2011 Join Date
    7,610Posts

    Re: Selecting Users with Option Tag

    Think your HTML isn't correct. Use ctrl+u to see the page source code.

  9. #9
    Alpha Member Glee is offline
    MemberRank
    Jun 2009 Join Date
    Niagara Falls,Location
    2,225Posts

    Re: Selecting Users with Option Tag

    Been fixed!



Advertisement