Sunday, June 28, 2009

Simple select statement using mysqli [PHP5]

Hi, i used to use PHP4 and it is about 2 year i'm not touch any development in PHP.

But for last week, i just got a project from my boss and it is using PHP. Although i just need to supervised the project but i need to know how to it is going to be done.

So, i will put this code as a quick reference for me


$dbConn = new mysqli('localhost', 'root', '', 'samplestaff');


$sql="select staffno, staffname from staffdetails";

$query01=$dbConn->prepare($sql);
$query01->execute();
$query01->bind_result($staffno, $staffname);

while($query01->fetch()){
echo $staffno.":".$staffname."
";
}


?>

No comments:

Post a Comment