Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-20-2010, 09:01 PM   PM User | #1
inta74
New Coder

 
Join Date: Aug 2010
Posts: 18
Thanks: 1
Thanked 0 Times in 0 Posts
inta74 is an unknown quantity at this point
Question Help to fix errors

Hello CF's

i would be really grateful if someone could help me fix the errors
in a script i have

errors im getting after install
PHP Code:

Warning
mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/admin_dealer/dhdealer.co.cc/index.php on line 42

Warning
mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/admin_dealer/dhdealer.co.cc/index.php on line 45

Warning
mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/admin_dealer/dhdealer.co.cc/index.php on line 48 
File where the errors are occurring
PHP Code:
#
<?
#
$sql "select count(*) from moneymembers where active=1";
#
$result mysql_query($sql);
#
$rs mysql_fetch_row($result);
#
$sql2 "select sum(DAmount) from moneypool where approved=1";
#
$result2 mysql_query($sql2);
#
$rs2 mysql_fetch_row($result2);
#
$sql6 "select sum(Amount) from wtransaction where approved=1";
#
$result6 mysql_query($sql6);
#
$rs6 mysql_fetch_row($result6);
#
?>
*Lines 39 - 49
Thank you

Last edited by inta74; 11-20-2010 at 09:39 PM..
inta74 is offline   Reply With Quote
Old 11-20-2010, 09:16 PM   PM User | #2
MattF
Senior Coder

 
Join Date: Jul 2009
Location: South Yorkshire, England
Posts: 2,322
Thanks: 6
Thanked 304 Times in 303 Posts
MattF will become famous soon enoughMattF will become famous soon enough
Code:
$rs = ((mysql_num_rows($result)) ? mysql_fetch_row($result) : '');
Same applies to the other lines.
MattF is offline   Reply With Quote
Old 11-20-2010, 09:28 PM   PM User | #3
inta74
New Coder

 
Join Date: Aug 2010
Posts: 18
Thanks: 1
Thanked 0 Times in 0 Posts
inta74 is an unknown quantity at this point
hello and thanks,
i edited the code but the errors still seems to be there

PHP Code:
#
<?
#
$sql "select count(*) from moneymembers where active=1";
#
$result mysql_query($sql);
#
$rs = ((mysql_num_rows($result)) ? mysql_fetch_row($result) : '');
#
$sql2 "select sum(DAmount) from moneypool where approved=1";
#
$result2 mysql_query($sql2);
#
$rs2 = ((mysql_num_rows($result)) ? mysql_fetch_row($result2) : '');
#
$sql6 "select sum(Amount) from wtransaction where approved=1";
#
$result6 mysql_query($sql6);
#
$rs6 = ((mysql_num_rows($result)) ? mysql_fetch_row($result6) : '');
#
?>
and is this correct?
inta74 is offline   Reply With Quote
Old 11-20-2010, 09:32 PM   PM User | #4
MattF
Senior Coder

 
Join Date: Jul 2009
Location: South Yorkshire, England
Posts: 2,322
Thanks: 6
Thanked 304 Times in 303 Posts
MattF will become famous soon enoughMattF will become famous soon enough
Code:
<?php
#
$sql = "select count(*) from moneymembers where active=1";
#
$result = mysql_query($sql) or exit(mysql_error());
#
$rs = ((mysql_num_rows($result)) ? mysql_fetch_row($result) : '');
#
$sql2 = "select sum(DAmount) from moneypool where approved=1";
#
$result2 = mysql_query($sql2) or exit(mysql_error());
#
$rs2 = ((mysql_num_rows($result2)) ? mysql_fetch_row($result2) : '');
#
$sql6 = "select sum(Amount) from wtransaction where approved=1";
#
$result6 = mysql_query($sql6) or exit(mysql_error());
#
$rs6 = ((mysql_num_rows($result6)) ? mysql_fetch_row($result6) : '');
#
?>

Last edited by MattF; 11-20-2010 at 10:08 PM..
MattF is offline   Reply With Quote
Users who have thanked MattF for this post:
inta74 (11-20-2010)
Old 11-20-2010, 09:39 PM   PM User | #5
inta74
New Coder

 
Join Date: Aug 2010
Posts: 18
Thanks: 1
Thanked 0 Times in 0 Posts
inta74 is an unknown quantity at this point
Thank you very much matt
inta74 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 05:20 PM.


Advertisement
Log in to turn off these ads.