Jump to content
TNG Community
Sign in to follow this  
jmerkel

Same sql - different results

Recommended Posts

jmerkel

I put the following in the TNG report creater:

SELECT DAYNAME(marrdatetr) AS MarriageDayOfTheWeek, DAYOFWEEK(marrdatetr) AS MarriageDayOfTheWeekNumber, COUNT(*) AS Total FROM tng_families WHERE DAYOFWEEK(marrdatetr)>0 GROUP BY MarriageDayOfTheWeekNumber;

I get the following results here:

http://www.merkelsearch.com/gendata/showre...php?reportID=45

I put the same sql as above in a plain php page where I connect to the database etc. and I get different results here:

http://www.merkelsearch.com/gendata/testreport2.php

This is the code after I connect to the database on the testreport2.php page:

$result = mysql_query("SELECT DAYNAME(marrdatetr) AS MarriageDayOfTheWeek, DAYOFWEEK(marrdatetr) AS MarriageDayOfTheWeekNumber, COUNT(*) AS Total FROM tng_families WHERE DAYOFWEEK(marrdatetr)>0 GROUP BY MarriageDayOfTheWeekNumber;");

//write tabl information

echo "<table border='1' width='300' cellpadding='3' cellspacing='3'>";

//fetch tha data from the database into rows

while ($row = mysql_fetch_array($result))

{

echo "<td>{$row['MarriageDayOfTheWeek']}</td> <td>{$row['Total']}</td> </tr>";

}

mysql_close($dbhandle);

echo "</table>";

-------------------------

Why am I getting two different sets of numbers?

Share this post


Link to post
Share on other sites
theKiwi

One includes living people and the other doesn't?

Roger

Share this post


Link to post
Share on other sites
jmerkel

I put the following in the TNG report creater:

SELECT DAYNAME(marrdatetr) AS MarriageDayOfTheWeek, DAYOFWEEK(marrdatetr) AS MarriageDayOfTheWeekNumber, COUNT(*) AS Total FROM tng_families WHERE DAYOFWEEK(marrdatetr)>0 GROUP BY MarriageDayOfTheWeekNumber;

I get the following results here:

http://www.merkelsearch.com/gendata/showre...php?reportID=45

I put the same sql as above in a plain php page where I connect to the database etc. and I get different results here:

http://www.merkelsearch.com/gendata/testreport2.php

This is the code after I connect to the database on the testreport2.php page:

$result = mysql_query("SELECT DAYNAME(marrdatetr) AS MarriageDayOfTheWeek, DAYOFWEEK(marrdatetr) AS MarriageDayOfTheWeekNumber, COUNT(*) AS Total FROM tng_families WHERE DAYOFWEEK(marrdatetr)>0 GROUP BY MarriageDayOfTheWeekNumber;");

//write tabl information

echo "<table border='1' width='300' cellpadding='3' cellspacing='3'>";

//fetch tha data from the database into rows

while ($row = mysql_fetch_array($result))

{

echo "<td>{$row['MarriageDayOfTheWeek']}</td> <td>{$row['Total']}</td> </tr>";

}

mysql_close($dbhandle);

echo "</table>";

-------------------------

Why am I getting two different sets of numbers?

I solved my own question.

Sorry for the bother.

Share this post


Link to post
Share on other sites
theKiwi

I solved my own question.

Sorry for the bother.

And the answer is???

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×