Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in. .

Initiate Mage
Joined
Feb 8, 2009
Messages
4
Reaction score
0
Hey guys, im just working on making bcstorm compatable with my custom database

i keep on getting this really unexpected error

" Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in. . . "

My code is:

Code:
final public function getPageHome()
	{
		global $template, $engine;
		$a = 1;
		$data = mysql_query("SELECT title, id, published, shortstory, image FROM cms_news ORDER BY id DESC LIMIT 5");
                
        while($news = mysql_fetch_array($data, MYSQL_ASSOC))  // this is where the error is ..
       	{
            $template->setParams('newsTitle-' . $a, $news['title']);
            $template->setParams('newsID-' . $a, $news['id']);
            $template->setParams('newsDate-' . $a, date("d-m-y", $news['published']));
            $template->setParams('newsCaption-' . $a, $news['shortstory']);
            $template->setParams('newsIMG-' . $a, $news['image']);
        	$a++;

Please help me get this working :(
 

r63

Elite Diviner
Joined
Jan 27, 2012
Messages
417
Reaction score
63
Try $data = @mysql_query("SELECT title, id, published, shortstory, image FROM cms_news ORDER BY id DESC LIMIT 5");
 
Upvote 0

r63

Elite Diviner
Joined
Jan 27, 2012
Messages
417
Reaction score
63
You should never supress errors, except for non-blocking sockets in php.

__

@skitsafrenic: Copy the table cms_news from a phoenix database to your bcstorm (Where does the "c" stand for?) database

True, but it would of been a quick fix.
 
Upvote 0
Initiate Mage
Joined
Feb 8, 2009
Messages
4
Reaction score
0
Thanks azaidi, idk why i dident just try that in the first place ..
i guess becuase i wanted to have 100% custom code xD but using a part of phoenix isent to bad i guess
 
Upvote 0
I don't even know
Loyal Member
Joined
Apr 7, 2010
Messages
1,699
Reaction score
420
True, but it would of been a quick fix.

No it's not. It just hides the error, and makes a not working news page.

Thanks azaidi, idk why i dident just try that in the first place ..
i guess becuase i wanted to have 100% custom code xD but using a part of phoenix isent to bad i guess

If you really want to use your own code you could design your own news table, but in the end it has the same effect as just using the Phoenix table.
 
Upvote 0
Initiate Mage
Joined
Feb 8, 2009
Messages
4
Reaction score
0
yea i think im going to stick with the phoenix table for simplicity :) thanks again for your help
 
Upvote 0
Back
Top