Subject: what'm i doing wrong?

Posted on: 20/04/06 02:27pm
By: Anonymous

function phpblock_happytimes ()
{
    $sql = "SELECT SUM(times) FROM table WHERE DATE_SUB( CURDATE( ) , INTERVAL 31 DAY ) <= date GROUP BY WEEK(date) DESC LIMIT 4";
    return DB_query($sql);
}


I get "Resource id #133" from the Home topic (125, 124, & 120 on other topics) in that block.

The SQL is legit and should return 2 rows of 1 field (does in phpMyAdmin). Admittedly I know little about php. Can anyone help?

Thanks

what'm i doing wrong?

Posted on: 20/04/06 03:03pm
By: THEMike

DB_query either returns false, or a result set resource. It does not return any HTML or anything that can be directly evaluated to a meaningful string.

You will need to write some code to loop through all the results in that result set and format them up as HTML. Using DB_numResults (hmm not 100% sure that's the right function name) and DB_fetchArray.

what'm i doing wrong?

Posted on: 20/04/06 03:28pm
By: Anonymous

You mention DB_. Where can I find out more about those functions??

Thanks for your help,

what'm i doing wrong?

Posted on: 20/04/06 03:40pm
By: THEMike

lib-database.php in the system directory of your geeklog install.

what'm i doing wrong?

Posted on: 20/04/06 03:55pm
By: Anonymous

Thanks.

I got it working already. I'll have to read thru that file and get this figured out. Thanks for the pointers though.


Geeklog - Forum
https://www.geeklog.net/forum/viewtopic.php?showtopic=66406