“Php Read SQL” Réponses codées

requête SQL en php

$sql = "SELECT id, firstname, lastname FROM MyGuests";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
        echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";
    }
} else {
    echo "0 results";
}
$conn->close();
Terrible Toucan

Php Read SQL

$qry = "SELECT * FROM database.table;";		//create Query
$result = $db -> query($qry);				//send and get result

$resultArray = $result->fetchAll();			//fetch result
  
echo $resultArray;			
Real Reindeer

PHP Get SQL Query

echo $select->__toString();
Prasanti Prusty

PHP Get Result SQL Server

//on sql server
public function get_data_from($id){
  $request = "SELECT * FROM yourTable 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;
}
Sorann

Réponses similaires à “Php Read SQL”

Questions similaires à “Php Read SQL”

Plus de réponses similaires à “Php Read SQL” dans PHP

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code