how to call a php function when we open the page -


/*the function fetches data database */public function allclients() {     try     {         $stmt = $this->conn->query("select * client");         $results = $stmt->fetchall(pdo::fetch_assoc);         return $results;     }     }     catch(pdoexception $e)     {         echo $e->getmessage();     } } 

this next page function called.i have used fetch button:'btn-signup' want display data in table without using button how do that.

$client2 = new client2(); if (isset($_post['btn-signup']))  {       try     {                $results=$client2->allclients();              foreach(array ($results) $row)          {               $id = $row['id'];             $name = $row['name'];             $email = $row['email'];             echo $id."\t\t";             echo $name."\t\t";             echo $email;             echo "\n\n";          }      }     catch(pdoexception $e)     {         echo $e->getmessage();     }  } 

the table in need fetch values.thank

<table id="data-table-command" class="table table-striped table-vmiddle">                             <thead>                                 <tr>                                     <th data-column-id="id" data-type="numeric">id</th>                                     <th data-column-id="sender">sender</th>                                     <th data-column-id="received" data-order="desc">received</th>                                     <th data-column-id="commands" data-formatter="commands" data-sortable="false">commands</th>                                 </tr>                             </thead>                             <tbody>                                                         <tr>                                     <td>10238</td>                                     <td>eduardo@pingpong.com</td>                                     <td>14.10.2013</td>                                 </tr>                                 <tr>                                     <td>10243</td>                                     <td>eduardo@pingpong.com</td>                                     <td>19.10.2013</td>                                 </tr></tr>                             </tbody>                         </table> 

<table id="data-table-command" class="table table-striped table-vmiddle">     <thead>         <tr>            <th data-column-id="id" data-type="numeric">id</th>            <th data-column-id="sender">sender</th>            <th data-column-id="received" data-order="desc">received</th>            <th data-column-id="commands" data-formatter="commands" data-sortable="false">commands</th>         </tr>     </thead>     <tbody>         <?php         foreach( array($results) $row )          {            echo '<tr>';            echo '<td>' . $row['id'] . '</td>';            echo '<td>' . $row['name'] . '</td>';            echo '<td>' . $row['email'] . '</td>';            echo '</tr>';         }         ?>     </tbody> </table> 

you foreach inside table printing vars proper table markup


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -