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
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.
Re: Selecting Users with Option Tag
Quote:
Originally Posted by
Aamiainen
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
Re: Selecting Users with Option Tag
Quote:
Originally Posted by
Glee
Even with that code it's still showing up blink
you're missing ";" mark after your echo.
Re: Selecting Users with Option Tag
Quote:
Originally Posted by
Aamiainen
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'].'"';
}
?>
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.
Re: Selecting Users with Option Tag
Quote:
Originally Posted by
Aamiainen
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
Re: Selecting Users with Option Tag
Think your HTML isn't correct. Use ctrl+u to see the page source code.
Re: Selecting Users with Option Tag