Jump to content

Between not returning expected results


tjverge

Recommended Posts

Have you tried executing the query in phpMyAdmin to see what it returns? I don't see any reason it shouldn't work unless there are no matching records. Post the code you're using to run the query and display the results.

I put together a php code for it and it finds 1 record that way.

$sql = "SELECT sum('chiralstuctors') FROM `pi` WHERE `pilot` = 'Test' AND `pidate` BETWEEN '2011-2-1' AND '2011-2-7'";
$results= mysql_query($sql) or die(mysql_error());
$numrows = mysql_num_rows($results);
Echo $numrows. "Records found";

 

Is that what you meant by finding  the number of records returned?

I was just making sure you weren't mistakenly using SUM() when you intended to use COUNT(); that happens fairly frequently.

 

So we're on the same page here, The query executes without error in phpMyAdmin, and returns a value of 0 for sum(`chiralstructors`), correct? How many results does the query show it returns if you change it to read

 

SELECT `chiralstructors` FROM `pi` . . .  instead of using the SUM function?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.