steelmanronald06 Posted September 25, 2006 Share Posted September 25, 2006 [b]Warning:[/b][quote]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\cms\includes\functions.php on line 41[/quote][b]functions.php LINES: 30-43[/b][code]<?php30: //*** Function: query, PUrpose: Execute a database query ***31: function $dbquery($query) {32:33: $this->theQuery = $query;34: return mysql_query($query, $this->link) or die(mysql_error());35:36: }37: 38: //** Function: fetchArray, Purpose: Get array of query results ***39: function mysqlfetchArray($result) {40: 41: return mysql_fetch_array($result) or die(mysql_error());42:43: }?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/22017-mysql_fetch_array/ Share on other sites More sharing options...
fenway Posted September 25, 2006 Share Posted September 25, 2006 I'm not sure how I can help here.... Quote Link to comment https://forums.phpfreaks.com/topic/22017-mysql_fetch_array/#findComment-98435 Share on other sites More sharing options...
steelmanronald06 Posted September 25, 2006 Author Share Posted September 25, 2006 I can move it to PHP help, but since it is dealing with mysql I was just wondering where it should go :) ha ha ha! I mean it is a bit of both, but since there is alot of OOP I will move it to php. Quote Link to comment https://forums.phpfreaks.com/topic/22017-mysql_fetch_array/#findComment-98439 Share on other sites More sharing options...
craygo Posted September 25, 2006 Share Posted September 25, 2006 Usually that means a problem with your sql statement. Either wrong field name or misspelled name. Echo out your statement and see what it saysRay Quote Link to comment https://forums.phpfreaks.com/topic/22017-mysql_fetch_array/#findComment-98442 Share on other sites More sharing options...
HuggieBear Posted September 25, 2006 Share Posted September 25, 2006 The error's telling you the problem is with the [url=http://uk.php.net/manual/en/function.mysql-query.php]mysql_query()[/url] command.Look a little closer at the error:[quote]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\cms\includes\functions.php on line 41[/quote]What this means is that where you have [code=php:0]mysql_fetch_array($result)[/code], $result is not a valid resource. Implying that this didn't work properly:[code=php:0]return mysql_query($query, $this->link) or die(mysql_error());[/code]Or that it did work correctly, but the line that's calling it is not [code=php:0]$result = dbquery($query);[/code]and last but by no means least, and possibly the cause of the problem :) you have [code=php:0]function $dbquery($query){[/code] this should probably just be [code=php:0]function dbquery($query){[/code] without the [b]$[/b] at the beginning of the function name.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/22017-mysql_fetch_array/#findComment-98473 Share on other sites More sharing options...
xyn Posted September 25, 2006 Share Posted September 25, 2006 [quote author=HuggieBear link=topic=109453.msg441226#msg441226 date=1159212813]The error's telling you the problem is with the [url=http://uk.php.net/manual/en/function.mysql-query.php]mysql_query()[/url] command.Look a little closer at the error:[quote]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\cms\includes\functions.php on line 41[/quote]What this means is that where you have [code=php:0]mysql_fetch_array($result)[/code], $result is not a valid resource. Implying that this didn't work properly:[code=php:0]return mysql_query($query, $this->link) or die(mysql_error());[/code]Or that it did work correctly, but the line that's calling it is not [code=php:0]$result = dbquery($query);[/code]and last but by no means least, and possibly the cause of the problem :) you have [code=php:0]function $dbquery($query){[/code] this should probably just be [code=php:0]function dbquery($query){[/code] without the [b]$[/b] at the beginning of the function name.RegardsHuggie[/quote]It's worth a try, however if that was the case,your first error would be "Unknown function" bla bla...However i think it could be:function "MYSQLFETCHARRAY($query)" Quote Link to comment https://forums.phpfreaks.com/topic/22017-mysql_fetch_array/#findComment-98479 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.