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
Old 12-23-2007, 05:55 AM Weird Error
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
Why Do i Get This Error With This Code:

Error:
PHP Code:
Warning:  mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/champion/public_html/functions/tables.php on line 7 
Code:
PHP Code:
<?php 
include("**");
// Update League Table After Games
$league "Premiership";
                    
mysql_query("DELETE FROM `manager__tables` WHERE `league` = '$league'");
                    
$sql mysql_query("SELECT * FROM `manager__teams` WHERE `league` = '$league'");
            while(
$row mysql_fetch_array($sql))
            {
             
$played mysql_num_rows(mysql_query("SELECT * FROM `manager__games` WHERE `home_team` = '" $row['id'] . "' || `away_team` = '" $row['id'] . "'"));
             
// Wins
             
$win mysql_num_rows(mysql_query("SELECT * FROM `manager__games` WHERE `home_team` = '" $row['id'] . "' && `home_points` = '3'"));
             
$win $win mysql_num_rows(mysql_query("SELECT * FROM `manager__games` WHERE `away_team` = '" $row['id'] . "' && `away_points` = '3'"));
             
// Draw
             
$draw mysql_num_rows(mysql_query("SELECT * FROM `manager__games` WHERE `home_team` = '" $row['id'] . "' && `home_points` = '1'"));
             
$draw $draw mysql_num_rows(mysql_query("SELECT * FROM `manager__games` WHERE `away_team` = '" $row['id'] . "' && `away_points` = '1'"));
             
// Lose
             
$lose mysql_num_rows(mysql_query("SELECT * FROM `manager__games` WHERE `home_team` = '" $row['id'] . "' && `home_points` = '0'"));
             
$lose $lose mysql_num_rows(mysql_query("SELECT * FROM `manager__games` WHERE `away_team` = '" $row['id'] . "' && `away_points` = '0'"));
             
// Goals For
             
$sql mysql_fetch_array(mysql_query("SELECT SUM(home_score) FROM `manager__games` WHERE `home_team` = '" $row['id'] . "'"));
             
$sql2 =  mysql_fetch_array(mysql_query("SELECT SUM(away_score) FROM `manager__games` WHERE `away_team` = '" $row['id'] . "'"));
             
$for $sql['SUM(home_score)'] + $sql2['SUM(away_score)'];
             
// Goals Against
             
$sql mysql_fetch_array(mysql_query("SELECT SUM(away_score) FROM `manager__games` WHERE `home_team` = '" $row['id'] . "'"));
             
$sql2 =  mysql_fetch_array(mysql_query("SELECT SUM(home_score) FROM `manager__games` WHERE `away_team` = '" $row['id'] . "'"));
             
$against $sql['SUM(away_score)'] + $sql2['SUM(home_score)'];
             
// Goal Difference
             
$goal_difference $for $against;
             
// Total Points
             
$points = ($win 3) + ($draw 1);
             
// Truncate & New League Stats
             
mysql_query("INSERT INTO `manager__tables` ( `team_id` , `played`, `win`, `draw` , `lose, `goals_for`, `goals_against`, `goal_difference`, `points`, `league` ) VALUES ('" $row['id'] . "', '$played', '$win', '$draw', '$lose', '$for', '$against', '$goal_difference', '$points', '$league')");
             }
                    
?>
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
 
Register now for full access!
Old 12-23-2007, 06:01 AM Re: Weird Error
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
Found out why i had $sql in my while so it buggered up!
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
Old 12-23-2007, 08:07 AM Re: Weird Error
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
I think a good feature could be the ability to delete your own threads, as long as no one else has replied and its within a certain time scale

Lol im always doing this and right after i post it a realise the problem! LOL
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Reply     « Reply to Weird Error
 

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.64336 seconds with 12 queries