Jump to content

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?

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.