Irish SEO,  Marketing & Webmaster Discussion

 

mysql function error

This is a discussion on mysql function error within the Coding Help forums, part of the Webmaster Help category; I can't seem to see the problem here, its saying the while.... line is giving this error(this function works on ...


Go Back   Irish SEO, Marketing & Webmaster Discussion > Webmaster Help > Coding Help

Register Forum Rules FAQDonate Members List Calendar Search Today's Posts Mark Forums Read


Notices

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-03-2008, 12:45 AM
ziycon's Avatar
Wannabe Geek
 
Join Date: Jan 2007
Location: Dublin
Posts: 410
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
ziycon will become famous soon enough
Send a message via MSN to ziycon Send a message via Skype™ to ziycon
Default mysql function error

I can't seem to see the problem here, its saying the while.... line is giving this error(this function works on other function calls):

Quote:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Apache\htdocs\sys_config\sql.php on line 192
PHP Code:
function check_admin_userid($id) {
    
$validate false;
    
$sql mysql_query("SELECT userid FROM admin_level WHERE userid = ".$id." AND level = 0 LIMIT 1");
    while (
$row mysql_fetch_array($sql)) 
    {
        if(
$row['userid'] == $id)
        {    
            
$validate true;
        }
    }
    return 
$validate;

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 07-03-2008, 01:17 AM
Frodo's Avatar
Ciaran Rooney - Weeno Ltd
 
Join Date: Jan 2007
Location: London
Posts: 360
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Frodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud of
Send a message via MSN to Frodo Send a message via Skype™ to Frodo
Default

I would say you have closed your mysql connect somewhere before you called this function. Do you use mysql_close();

EDIT: why are you using a while loop that sql statement should only return one value, no? just to be safe?
__________________
PHP Code:
print "CEO Weeno Ltd   - http://www.weeno.ie";
print 
"CTO Skimbit Ltd - http://skimbit.com"
skimlinks.com :: Outsource your affiliate marketing and generate revenue from your content easily.

Last edited by Frodo; 07-03-2008 at 01:19 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 07-03-2008, 01:23 AM
ziycon's Avatar
Wannabe Geek
 
Join Date: Jan 2007
Location: Dublin
Posts: 410
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
ziycon will become famous soon enough
Send a message via MSN to ziycon Send a message via Skype™ to ziycon
Default

Quote:
Originally Posted by Frodo View Post
I would say you have closed your mysql connect somewhere before you called this function. Do you use mysql_close();
Your a star, after looking at this code for so long you really need a fresh pair of eyes!

Quote:
Originally Posted by Frodo View Post
EDIT: why are you using a while loop that sql statement should only return one value, no? just to be safe?
Force of habit.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 07-03-2008, 01:38 AM
Frodo's Avatar
Ciaran Rooney - Weeno Ltd
 
Join Date: Jan 2007
Location: London
Posts: 360
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Frodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud of
Send a message via MSN to Frodo Send a message via Skype™ to Frodo
Default

Had a similar problem a while back, left it for a week or two, came back and was like how did I not spot that.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
error, function, mysql

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
ASP VB, MYSQL and ODBC error ASP 0115 matt-dublin Coding Help 4 13-09-2007 01:39 PM
PHP mySQL Problem!? ziycon Server / Technical Administration Tips and Queries 1 15-07-2007 08:31 PM
mysql 3rigena Webmaster Discussion 4 24-05-2007 09:33 PM
PHP function giving trouble. louie Coding Help 1 26-01-2007 11:51 PM


Sponsored links

Paid On Results


All times are GMT +1. The time now is 01:39 PM.


Powered by: vBulletin Version 3.7.3, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
Hosted in Ireland by Blacknight - Test your ISP |Irish Hosting Directory| Armchair.ie|Logo by Eden Web Design|Avatars by Afterglow |Latest Blog Entries | VPS HostingAd Management by RedTyger

Search Engine Friendly URLs by vBSEO 3.2.0