update page now

Voting

: eight minus seven?
(Example: nine)

The Note You're Voting On

atulkashyap1 at hotmail dot com
16 years ago
bind_ result can also be used to return an array of variables from a function,
This took me a long time to figure out, so I would like to share this.

<?php
function extracting(){
  $query="SELECT topic, detail, date, tags
    FROM updates
    ORDER BY date DESC
    LIMIT 5 ";
  if($stmt = $this->conn->prepare($query)) {
    $stmt->execute();
    $stmt->bind_result($updates[0],$updates[1],$updates[2],$updates[3]);
    $i=0;
    while($stmt->fetch()){
      $i++;
      $name='t'.$i;
      $$name = array($updates[0],$updates[1],$updates[2],$updates[3]);
    }
    return array($t1,$t2,$t3,$t4,$t5,);
    $stmt->close();
  }
}
?>

<< Back to user notes page

To Top