[prev in list] [next in list] [prev in thread] [next in thread] 

List:       phplib-dev
Subject:    [PHPLIB-DEV] Memory or code/seesion problem?
From:       serghej petrov <petrov () datasport ! it>
Date:       1999-10-27 17:25:57
[Download RAW message or body]

Hi
Using functions (odbc_*, and mysql_*) following cod is executed immediatly:

//*******orig code**********//
$mydb=odbc_connect("mydb","user","pass");

$query_select="SELECT id from libri WHERE data=Getdate()";

$result=odbc_exec($mydb,$query_select);
$tot=0;
while (odbc_fetch_row($result)) {

print $i . " - " . odbc_result($result,"id") . "<br>";
$ar[]=odbc_result($result,"id");
$tot++;

}

$i=rand()%$tot+1;
print $ar[$i] . " $i <br>";
?>
//*********end orig cod*********//

BUT this same code with phplib 7.2 with about 30 articles work very slow and
with more 50 articles don't work at all:
//*********phplib cod**************//
if (!$sess->is_registered("id_art")  ) {

   $query = "select id from articles where data=Getdate()";
    $db->query($query);
    $tot=$db->num_rows();

     while($db->next_record()) {
               $id_art[] = $db->f("id"); //all id put into array about 200
       }

       $sess->register("id_art");    // register array $id_art in session
       $sess->register("tot"); // and how many new articles i have

}  //end if

$i=rand()%$tot+1; //Extract random number from number of new articles
print $id_art[$i] ; // print random id from array

//**************end******//

Whats wrong?
Can anybody help me?
Thanks all

Serghej Petrov

-
PHPLIB Developers Mailing List. Send messages to <phplib-dev@lists.netuse.de>.
To unsubscribe, send "unsubscribe" to <phplib-dev-request@lists.netuse.de> in
the body, not the subject, of your message.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic