<?php
//database connect
$db=mysqli_connect("localhost","root","","mycompanyhr");
//checking database connection
if ($db==false) {
echo "Connect failed: ". mysqli_connect_error($db);
exit();
}
else {
echo "Connection successful";
}
$sql="select EMPNO, FIRSTNAME, LASTNAME, WORKDEPT, PHONENO
from employee";
$rs=mysqli_query($db,$sql);
if($rs==false){
echo ("Query cannot be executed!<br>");
echo ("SQL Error : ".mysqli_error($db));
}
else{
echo "<table border=1>";
echo "<tr>";
echo "<td>Employee no</td>";
echo "<td>Firstname</td>";
echo "<td>Lastname</td>";
echo "<td>Department</td>";
echo "<td>Extension</td>";
echo "</tr>";
echo "</table>";
while($rekod=mysqli_fetch_array($rs)){
echo " Employee no: ".$rekod['EMPNO']."<br>";
echo " First name: ".$rekod['FIRSTNAME']."<br>";
echo " Last name: ".$rekod['LASTNAME']."<br>";
echo " Department code: ".$rekod['WORKDEPT']."<br>";
echo " Phone no: ".$rekod['PHONENO']."<hr>";
}
}
?>
Create your own blog and send the address by submitting the comment of this article. Make sure to provide your full name, matrix and URL address of your blog. Refer to the picture below. Manual on developing a blog using blogger.com and AdSense, download here … Download Windows Live Writer (a superb offline blog post editor)
Comments
Post a Comment