fetch_assoc

Issue #19 invalid
Cristian Gabriel created an issue

Hi

I try to find a good solution to while a query but I`m not get anywere .

I start to use your class and I love it but the main issues is I have few function to loop and print in other file.

I try whit foreach but this need to be on same function or to loop corecly I need to pass a limit.

It`s posible to add a function like

while ( $row = $db->fetch_assoc){ $demo = $row; }

Thanks.

Comments (4)

  1. Cristian Gabriel reporter

    If i try to db->fetch() in while ... I will get Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 8 bytes)

  2. Vivek N repo owner
    You can use it like this. 
    
    $rows = $db->from('tblname')->fetch();
    foreach($rows as $row)
    {
       echo $row['email'];
    }
    
  3. Cristian Gabriel reporter

    Ok I understand that !

    But if I need to loop in other place like

    foreach($rows as $row){ $print = $row }

    echo $row

    I can`t loop vecause foreach need to be inside to loop it !

    The issues was ... I create my project about 7 day and now ... I see this mysqli Class do not support to be put in while !

    If the project was create in smarty or other platform will be hard to display a loop whit not have while !

    Can you point a direction or something to add new future about this ?

  4. Log in to comment