Current location: Hot Scripts Forums » Programming Languages » PHP » mysql fetch array problem


mysql fetch array problem

Reply
  #1 (permalink)  
Old 03-31-04, 07:39 PM
darkcarnival's Avatar
darkcarnival darkcarnival is offline
PHP/MySQL coder
 
Join Date: Jun 2003
Location: Michigan
Posts: 939
Thanks: 0
Thanked 0 Times in 0 Posts
mysql fetch array problem

hi,

im making a quick code for my site so that on 1 page it will get the lastest 5 posts made. now im using the same code as i did for the ful news and it gives me this error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/httpd/vhosts/metalstation1.com/httpdocs/News2/quick_news.php on line 6

now this code will work on the ful news but noit the quick 1 :S

heres the code to the quick news

PHP Code:

        include "config.php";

        
$db_connection mysql_connect ($DB_HOST$DB_USER$DB_PASS) or die ('Could not connect to MySQL: ' mysql_error());
        
mysql_select_db ($DB_NAME) or die ('Could not Select Database: ' mysql_error());
        
$query "SELECT * FROM News_Posts ORDER BY Date DESC LIMIT 5";
        while (
$row mysql_fetch_array ($queryMYSQL_ASSOC)) {
list(
$year,$month,$day)= explode('-'$row['Date']);
$newdate =date("m-j-Y"mktime(000$month$day$year));
echo 
"<CENTER>";
echo 
"<B>{$row['Subject']}</B> -Posted By: {$row['Username']} on $newdate<BR><BR>";
$msg str_replace("\n","<br>"$row['Body']);
echo 
$msg;

echo 
"<BR><BR><HR width=\"395\"><BR>";
}
echo 
"</CENTER>"
not sure what the problem is? if you know of a different way for this to output please tell me.thx
__________________
Elite Bulletin Board
http://elite-board.us
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-31-04, 07:49 PM
darkcarnival's Avatar
darkcarnival darkcarnival is offline
PHP/MySQL coder
 
Join Date: Jun 2003
Location: Michigan
Posts: 939
Thanks: 0
Thanked 0 Times in 0 Posts
never mind i figured it out :duh: thx though
__________________
Elite Bulletin Board
http://elite-board.us
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 03:22 AM
Load Data Infile Problem (MySQL) Shaky2 PHP 1 03-26-04 05:48 PM
two questions....deleting mysql values and adding array value through forms mlbpa2 PHP 16 03-18-04 10:41 PM
MySQL Expert Required!! Advanced Query Problem bluey_the_punch PHP 1 02-28-04 02:37 PM
linking to iframe not working :( j0d JavaScript 5 01-19-04 09:14 PM


All times are GMT -5. The time now is 12:53 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.