Jump to content

[php] staff list script


bogdan012794

Recommended Posts

Hi i've created a script for a staff list, and it looks like this. This is for root admin.

but i have a problem. please take a look at my script :

<?PHP
require_once ( 'config.php');

mysql_connect ("$host","$user","$pass");
mysql_select_db ("$mangosrealm");

$result = mysql_query ("SELECT username FROM account WHERE gmlevel > 3 ORDER BY USERNAME)");

while ( $row = mysql_fetch_array($result))
{
 $t_name = $row['username'];
   echo "

[b]<span style='color: #B00000'>$t_name[/b]</span></p>";
}

?>  

the error is :

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in staff.php on line 123

at line 123 is :

while ( $row = mysql_fetch_array($result))

Ps. this is the whole script, so if you wonder why at 123 lines, i have other things in the staff.php page ..

help pls ??:D

Link to comment
Share on other sites

mysql_connect ("$host","$user","$pass");
mysql_select_db ("$mangosrealm");

You have variables surrounded by quotes here.

$result = mysql_query ("SELECT username FROM account WHERE gmlevel > 3 ORDER BY USERNAME)");

This query is written incorrectly. "SELECT username FROM account WHERE gmlevel > 3 ORDER BY USERNAME)" What is the ) for?

while ( $row = mysql_fetch_array($result))
{
 $t_name = $row['username'];
   echo "

[b]<span style='color: #B00000'>$t_name[/b]</span></p>";
}

I actually don't see anything wrong with this part.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use