I wrote a SQL query with PDO. DB table has 3 results with match the query. But the PDO shows only one result.
my code is this
conn.php
function connect() {
$servername = "localhost";
$dbname = "guiding_db";
$username = "user";
$password = "pass";
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return $conn;
}
_admin.php
include_once './conn.php';
function getStudentsRequests(){
$sql = "SELECT * FROM `user` WHERE signas = 'student' AND accept='0'";
$result = connect()->query($sql);
$out = $result->fetch(PDO::FETCH_ASSOC);
print_r($out);
return $out;
}
getStudentsRequests();
Aucun commentaire:
Enregistrer un commentaire