lokeh Posted November 8, 2006 Share Posted November 8, 2006 So I'm using an enum to determine three user groups in my sql db. Which looks like the following in the sql table for users.[code]CREATE TABLE `users` ( `id` int(11) NOT NULL auto_increment, `username` varchar(30) NOT NULL default '', `password` varchar(255) NOT NULL default '', `email` varchar(40) NOT NULL default '', `status` enum('active','inactive') NOT NULL default 'Active', PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;[/code]So I'm using enum to manage the groups. Now on my PHP include page, I'm using the following:[code]<?ob_start();if (!$_GET[user]){$getuser = mysql_query("SELECT * from users where status='active' order by id asc");while ($user = @mysql_fetch_array($getuser)){?>[/code]However, when i attempt to run my page, I'm presented with the following syntax error relating to my while statement:[code]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxx/public_html/v5/includes/inc_members.php on line 6[/code]Could someone point out what i've done wrong?Cheers guys.lokeh Link to comment https://forums.phpfreaks.com/topic/26562-errors-with-while-statement/ Share on other sites More sharing options...
joshi_v Posted November 8, 2006 Share Posted November 8, 2006 Problem is in your query only! not in while loopsee![code]mysql_query("SELECT * from users where status='active' order by id asc");[/code]In the query status='active' , but while creating table you mention it as 'Active'.So that is the difference.[code]mysql_query("SELECT * from users where status='Active' order by id asc");[/code]Regards,Joshi. Link to comment https://forums.phpfreaks.com/topic/26562-errors-with-while-statement/#findComment-121499 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.