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 :(
 
Try $data = @mysql_query("SELECT title, id, published, shortstory, image FROM cms_news ORDER BY id DESC LIMIT 5");
 
Upvote 0
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
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
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
Back
Top