Answers for "how to get values from select prepared statement"

PHP
1

php get data from prepared select

//on sql server
public function get_data_from($id){
  $request = "SELECT * FROM tableName WHERE id = ?";

  //preparing the request
  $stmt = $this->dbh->prepare($request);

  //executing the request
  $stmt->execute( array($id)  );

  //fetching the result of the request
  $result = $stmt->fetchAll();

  return $result;
}
Posted by: Guest on May-31-2021

Code answers related to "how to get values from select prepared statement"

Browse Popular Code Answers by Language