views:

23

answers:

2

Hello,

I am using a Wampserver 2.0 for database-web development. When i ran the following the php code which is embbeded in my html form, the server crashes meanwhile other php processes on different pages are responding effectively. I have checked my apache error log and saw the following message: [Fri Oct 22 11:37:04 2010] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/setapro/setapro, referer: This is php code i executed:

<?php 
include 'db_inc.php';
$sql    = "select AVG(no_of_satelites) as 'Mean Number of Satelites', AVG(         height_of_geoid ) as'Mean of HDOP', AVG(rmc_gga_longitude) as 'Mean of Longitude', AVG(rmc_gga_latitude) as 'Mean of latitude'  FROM total_rmcs_ggas ";
$result = mysql_query($sql, $link);
if (!$result) {
die("Query to show averages from table failed");
}
echo 'Number of rows returned from query = '.mysql_num_rows($result) or die();
echo "<h2>Table:Averages for the GPS Receiver</h2>";
while ($row = mysql_fetch_assoc($result)){
echo $row['Mean Number of Satelites'].' '.$row['Mean of HDOP'].' '.$row['Mean of  Longitude'].' '.$row['Mean of latitude'].'<br />';
}
mysql_free_result($result);
mysql_close();
?>  

I do not know which file it is talking about as i have all the files in my document root. I need some assistance here. thank you. the "setapro" is the project folder name and not the file.

A: 

I just figured out that the mysql_close() was empty and I had to include the resource there in like this:mysql_close($link). Without this, the server crashes.

ibiangalex
A: 

I thought that php automatically cleans those resources up, maybe you should try a Linux distribution which is far better than WAMP. :)

By the way the signature of mysql_close() is:

bool mysql_close ([ resource $link_identifier ] )

so the resource is not an optional parameter, you should be aware of that.

edem
Thanks. I sorted it out by including the resource link parameter. It was empty.
ibiangalex