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
Getting this error (please help)
Old 02-11-2009, 10:28 AM Getting this error (please help)
Extreme Talker

Posts: 176
Name: Aaric
Trades: 0
I am trying to do a fresh install of a game. I keep getting this:
Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in D:\AppServ\www\xerogame\includes\functions.php on line 100

Below is what like 100 of that file looks like. Not sure why there is a problem or what I need to change. Any suggestions?

// $AdminPage -> Si on est dans la section admin ... faut le dire ...
function display ($page, $title = '', $topnav = true, $metatags = '', $AdminPage = false) {
global $link, $game_config, $debug, $user, $planetrow;

if (!$AdminPage) {
$DisplayPage = StdUserHeader ($title, $metatags);
} else {
$DisplayPage = AdminUserHeader ($title, $metatags);
}

if ($topnav) {
$DisplayPage .= ShowTopNavigationBar( $user, $planetrow );
}
$DisplayPage .= "<center>\n". $page ."\n</center>\n";

$DisplayPage .= StdFooter();
if (isset($link)) {
mysql_close($link);
}

echo $DisplayPage;
aaricwon is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-11-2009, 10:38 AM Re: Getting this error (please help)
Insensus's Avatar
Ultra Talker

Posts: 487
Name: Mark Stegeman
Location: Netherlands, Europe
Trades: 0
If you can't close the MySQL connection stored in $link, this means there is something wrong with it, so probably there's a connection issue somewhere.
__________________
<?php ($helpfull>0)?$talkupation++ : '';?>
Insensus is offline
Reply With Quote
View Public Profile
 
Old 02-11-2009, 10:46 AM Re: Getting this error (please help)
Extreme Talker

Posts: 176
Name: Aaric
Trades: 0
I am sorry if these are dumb questions. I know a little about php and mysql but am pretty new to this.

What do you think could be wrong? I know my server name, database name, username, password for connecting. I just don't know what the problem is :-(
aaricwon is offline
Reply With Quote
View Public Profile
 
Old 02-11-2009, 10:58 AM Re: Getting this error (please help)
Insensus's Avatar
Ultra Talker

Posts: 487
Name: Mark Stegeman
Location: Netherlands, Europe
Trades: 0
In this part of the code, there is explicitly nothing wrong.
__________________
<?php ($helpfull>0)?$talkupation++ : '';?>
Insensus is offline
Reply With Quote
View Public Profile
 
Old 02-11-2009, 11:07 AM Re: Getting this error (please help)
Extreme Talker

Posts: 176
Name: Aaric
Trades: 0
Quote:
Originally Posted by Insensus View Post
In this part of the code, there is explicitly nothing wrong.
Thank you for looking. If you have any other suggestions please let me know. I really appreciate it.

This game has an install file and I've done things like this several times. Not sure what the issue is...
aaricwon is offline
Reply With Quote
View Public Profile
 
Old 02-11-2009, 11:55 AM Re: Getting this error (please help)
Mattmaul1992's Avatar
Ultra Talker

Posts: 486
Name: Matt
Trades: -1
Well, theres a few possibilities for this error. 1 and 2 involve your host - maxing out your connection limits or something in your PHP configuration file (yes, it may be PHP even though MySQL is returning this error).
I would say though the most likely cause is because of a previous error.
Most of the time when a developer is writing a script in every query they check for errors -
Code:
$result = mysql_query($query) or die ('Error in query: ' . mysql_error());
But sometimes the programmer is lazy and just runs the query without checking for errors -
Code:
$result = mysql_query($query);
It may be a query, it may be a connection issue...
__________________
PHP Code:
$talkupation++; 

Please login or register to view this content. Registration is FREE
- Free IPB forum hosting (releasing today!!!), no ads, free modifications
Mattmaul1992 is offline
Reply With Quote
View Public Profile
 
Old 02-11-2009, 01:28 PM Re: Getting this error (please help)
Defies a Status

Posts: 1,605
Trades: 0
You can leave off the $link part. Just use mysql_close();

Once a connection is made the system know what it is connected to.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 02-11-2009, 04:59 PM Re: Getting this error (please help)
anderswc's Avatar
Super Talker

Posts: 132
Name: Will Anderson
Location: Terre Haute, IN
Trades: 0
You should still be able to pass the connection link though. I think what's going on is that the link is never created. Maybe you should use if($link) rather than if(isset($link)). See if that makes a difference.
__________________
Will Anderson

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
anderswc is offline
Reply With Quote
View Public Profile Visit anderswc's homepage!
 
Old 02-11-2009, 11:47 PM Re: Getting this error (please help)
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
You can probably get away without closing the link at all because PHP will do this automatically at the end of execution.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Getting this error (please help)
 

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