1 (edited by lebel 2005-12-06 17:38)

Topic: add personal function in viewtopic

I would like to add data from another tables than PunBB in viewtopic.php


function myfunction($id_user){
    global $db;
    $result = $db->query('MYREQUESTHERE') or error('Unable to fetch request', __FILE__, __LINE__, $db->error());
    if ($db->num_rows($result)){
        return "MYDATATHERE";
    }
}

I would like to insert myfunction($id_user) between this line

while ($cur_post = $db->fetch_assoc($result))
{

AND this line
}


It's works with punbb 1.1.5 but not with 1.2.10 ! Display only one message ! I don't know why !
Anybody could help me ? I think it's a problem with $result = $db->

thx for ur help

Re: add personal function in viewtopic

Do you really want to run a query for each post?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3

Re: add personal function in viewtopic

Yes i would like to !

4

Re: add personal function in viewtopic

Although I agree with Rickard that adding a request for each topic is kinda adventurous smile - maybe you poat the code you are using here?

The German PunBB Site:
PunBB-forum.de

5 (edited by lebel 2005-12-08 08:42)

Re: add personal function in viewtopic

If I ask u, it's because I need it. I know it's better to integrate all in one request but here, I need to know how put a function in this loop !!!

Re: add personal function in viewtopic

And we can't help you unless you show us the code. We need to see the code in order to see what you're doing wrong.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

7

Re: add personal function in viewtopic

function myfunction($id_user){
    global $db;
    $result = $db->query('MYREQUESTHERE') or error('Unable to fetch request', __FILE__, __LINE__, $db->error());
    if ($db->num_rows($result)){
        return "MYDATATHERE";
    }
}

and in the loop

$user_info[] = myfunction($cur_post['poster_id']);

And it's display 1 message (normaly there s many)

with 1.1.5, i have no problem

Re: add personal function in viewtopic

I guess maybe that code has changed in some way between 1.2.5 and 1.2.10. I suggest you go to dev.punbb.org and have a look at what changes have been to the script in question.

"Programming is like sex: one mistake and you have to support it for the rest of your life."