Skythrust
Member
- Jul 9, 2019
- 133
- 7
Hi All,
I would like to have a view from my SQLSRV database, everything works fine only the looks aren't that much what I would like to have.
This is wat I got;
The "Plain Text" is what I want, the "Database value" is what I get.
Any suggests how I can realise this?
Code below;
Plain Text Code;
Database Value Code;
Thanks in advance!
I would like to have a view from my SQLSRV database, everything works fine only the looks aren't that much what I would like to have.
This is wat I got;
You must be registered for see links
The "Plain Text" is what I want, the "Database value" is what I get.
Any suggests how I can realise this?
Code below;
Plain Text Code;
PHP:
<div class="contentBox">
<div class="title">
Visitors
</div>
<div class="newVisitor">
<a href="#" class="name tip" title="Edit user">
Wendy Alaska
</a>
<div class="status signedout">Signed Out</div>
<div id="clearfix"></div>
</div>
<div class="newVisitor">
<a href="#" class="name tip" title="Edit user">
Amber Bamber
</a>
<div class="status signedin">Signed In</div>
<div id="clearfix"></div>
</div>
<div class="newVisitor">
<a href="#" class="name tip" title="Edit user">
Stan Lee
</a>
<div class="status signedunknown">Unknown</div>
</div>
<div id="clearfix"></div>
</div>
Database Value Code;
PHP:
<div class="contentBox">
<div class="title">
Visitors
</div>
<?php include 'config.php';
$connectionInfo = array( "Database"=>$SQL_InitialCatalog, "UID"=>$SQL_UserID, "PWD"=>$SQL_Password);
$conn = sqlsrv_connect( $SQL_DataSource, $connectionInfo);
$stmt = SQLSRV_QUERY( $conn, "SELECT Firstname,ISNULL(Middlename,'') AS Middlename,Lastname, CASE WHEN CheckInTime IS NOT NULL AND CheckOutTime IS NULL THEN 1 WHEN CheckInTime IS NOT NULL AND CheckOutTime IS NOT NULL THEN 2 ELSE 3 END AS Available FROM Visits
" );
if( $stmt === false) {
die( print_r(
$System_Message, true) );
}
echo "<table> ";
$item = 0;
while( $row = SQLSRV_FETCH_ARRAY( $stmt, SQLSRV_FETCH_ASSOC) ) {
echo "<td>"; ?>
<div class="newVisitor">
<a href="#" class="name tip" title="Edit user">
<?php echo $row["Firstname"]. ' ' .$row["Middlename"]. ' ' .$row["Lastname"]; ?>
</a>
<?php if ($row['Available'] == 1) { ?><div class="status signedin">Signed In</div><?php }
else if ($row['Available'] == 2) { ?><div class="status signedout">Signed Out</div><?php }
else if ($row['Available'] == 3) { ?><div class="status signedunknown">Unknown</div><?php } ?>
</div>
</div>
</div>
<?php echo "</td>";
$item++;
if ($item % 1 == 0) { echo '</tr><tr>'; } ?>
<div id="clearfix"></div>
</div>
<?php }
echo "</table> ";
sqlsrv_free_stmt( $stmt);
?>
Thanks in advance!