RE: need help with fetching a result using a function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I am trying to write a few functions for a project i need to do for
> school,
> this function should return all the inactive, or active users (1 or 0
> staffstatusid) as an array for creating a drop down menu.
> 
> Now when i perform the following code (yes it is included in a script
that
> connects to the databas i am using) it returns the following error.
> 
> "Warning:  Supplied argument is not a valid MySQL result resource in
> /home/filterseveuk/public_html/project/getusers.php on line 7"
> 
> and underneath the error it prints the value of var_dump($data)
> which is " NULL"
> 
> any ideas how to fix this?
> 
> 
> =================================================================
> <?
> function getusers($status){
> 
> 	$query = "SELECT FROM Staff WHERE Staffstatusid = '$status'";

Select _WHAT_ from the table? You do not have a valid query...

> 	$result = mysql_query($query);
> 	$row = mysql_fetch_array($result);
> 	$users[$status] = $row ;
> 	return $users[$status] ;
> }
> $status = 0 ;
> $data = getusers($status);
> var_dump($data);
> 
> echo $data;
> ?>

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux