Jump to content

different sql results


adzie

Recommended Posts

Hi people,

 

I have a small dilema i hope you can provide some advice or tips to try and resolve

 

I have two servers (in the process of moving servers)

 

I have copied over the database and scripts.

 

the results the SAME script provides is different on each server, the script it designed to total members online time, each session creates a record of duration online

 

I have manually checked the amount  of records and all appears to be normal.

 

Both windows servers.

 

any pointers?

 

thanks

Link to comment
Share on other sites

sorrry about that

 


<?php

error_reporting(E_ALL);

$hostName = 
$userName = 
$password = 
$dbName = 


mysql_connect($hostName, $userName, $password) or die("Unable to connect to host $hostName");
mysql_select_db($dbName) or die("Unable to select database $dbName");


$query_hours = "SELECT sec_to_time(sum(time_to_sec(t2.duration))) AS duration_sum FROM members t1, member_time t2 WHERE t1.member_num=t2.mnum";
$result_hours = mysql_query($query_hours);
if (mysql_numrows($result_hours) > 0)
{
$rtime = mysql_result($result_hours,0,"duration_sum");
$htime = substr($rtime,0,5);
$time = ($rtime + 7000);
}
$sql2="select * members";
$query2 = mysql_query($sql2);
$member = mysql_numrows($query2);
if($member == 0)
{
$avg = "0";
$time = "0:00:00";
}
else
{
$avg = $time/$member;
$avg = substr($avg,0, strpos($avg,".")+3);
}
?>

Link to comment
Share on other sites

You need to do some old fashion debugging. Echo out the values to find which one is not correct, then work back from there to find the problem.

 

With what you have posted so far, we don't know what the results should be and what you are getting when they are not correct. Which means the best you can get are guesses. Post your data with both the correct and incorrect answers.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.