Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Warning: mysql_fetch_array():
Old 08-15-2009, 07:32 AM Warning: mysql_fetch_array():
Super Talker

Posts: 102
Trades: 0
With this script that I asked for about 3-5 months back

PHP Code:
$i 0;
$latest '';
$postsQ '';
$threads mysql_query("SELECT * FROM threads WHERE board='".$row2['id']."' ORDER BY id ASC");
$list="";
while (
$thread mysql_fetch_array($threads)){
    if(
$list!=''){
        
$list.=",";
    }
    
$list.=$thread['id']; 
}
  
$posts mysql_query("SELECT * FROM posts WHERE thread in ($list) ORDER BY cDate DESC");  

while (
$row2A mysql_fetch_array($posts)){
    if (
$i == 0){
        
$latest format_date($row2A['cDate']).'<br />by ' returnUsername($row2A['creator']);
    }
    
$i++;

When nothing is in the DB for "posts" then it does a Warning, is there anyway other then to shut off PHP warnings to get it to stop.
Aaron™ is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-15-2009, 08:10 AM Re: Warning: mysql_fetch_array():
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
"It does a warning" is somewhat vague for debugging.

We may just need to know what the warning is.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-15-2009, 02:01 PM Re: Warning: mysql_fetch_array():
NullPointer's Avatar
Will Code for Food

Posts: 2,784
Name: Matt
Location: Irvine, CA
Trades: 0
@ will suppress any error messages from a particular line of code.

PHP Code:
$posts = @mysql_query("SELECT * FROM posts WHERE thread in ($list) ORDER BY cDate DESC");

if(!
$posts || @mysql_num_rows($posts) < 1)
{
     
//display no posts message
}
else
{
     while (
$row2A mysql_fetch_array($posts)){
         if (
$i == 0){
             
$latest format_date($row2A['cDate']).'<br />by ' returnUsername($row2A['creator']);
         }
         
$i++;
     }

__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 08-15-2009, 07:05 PM Re: Warning: mysql_fetch_array():
Super Talker

Posts: 102
Trades: 0
Works for me, thanks nullpointer
Aaron™ is offline
Reply With Quote
View Public Profile
 
Old 08-15-2009, 07:17 PM Re: Warning: mysql_fetch_array():
NullPointer's Avatar
Will Code for Food

Posts: 2,784
Name: Matt
Location: Irvine, CA
Trades: 0
Quote:
Originally Posted by Aaron™ View Post
Works for me, thanks nullpointer
No problem. Make sure you use it sparingly, error and warning messages are there to help you.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Reply     « Reply to Warning: mysql_fetch_array():
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15332 seconds with 12 queries