Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
PHP - view in column
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Skythrust" data-source="post: 454016" data-attributes="member: 87030"><p>Hi All,</p><p></p><p>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.</p><p></p><p>This is wat I got; <a href="http://prntscr.com/poj3j3" target="_blank">http://prntscr.com/poj3j3</a></p><p></p><p>The "Plain Text" is what I want, the "Database value" is what I get.</p><p></p><p>Any suggests how I can realise this?</p><p></p><p>Code below;</p><p></p><p>Plain Text Code;</p><p>[CODE=php]<div class="contentBox"></p><p> <div class="title"></p><p> Visitors</p><p> </div></p><p></p><p> <div class="newVisitor"></p><p> <a href="#" class="name tip" title="Edit user"></p><p> Wendy Alaska</p><p> </a></p><p> </p><p> <div class="status signedout">Signed Out</div></p><p></p><p> <div id="clearfix"></div></p><p> </div></p><p></p><p> <div class="newVisitor"></p><p> <a href="#" class="name tip" title="Edit user"></p><p> Amber Bamber</p><p> </a></p><p></p><p> <div class="status signedin">Signed In</div></p><p></p><p> <div id="clearfix"></div></p><p> </div></p><p></p><p> </p><p> <div class="newVisitor"></p><p> <a href="#" class="name tip" title="Edit user"></p><p> Stan Lee</p><p> </a></p><p></p><p> <div class="status signedunknown">Unknown</div></p><p></p><p> </div></p><p></p><p> <div id="clearfix"></div></p><p></div>[/CODE]</p><p></p><p>Database Value Code;</p><p>[CODE=php]<div class="contentBox"></p><p> <div class="title"></p><p> Visitors</p><p> </div></p><p> </p><p></p><p><?php include 'config.php';</p><p> $connectionInfo = array( "Database"=>$SQL_InitialCatalog, "UID"=>$SQL_UserID, "PWD"=>$SQL_Password);</p><p> $conn = sqlsrv_connect( $SQL_DataSource, $connectionInfo);</p><p> $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</p><p>" );</p><p> if( $stmt === false) {</p><p> die( print_r(</p><p> $System_Message, true) );</p><p> }</p><p> echo "<table> ";</p><p> $item = 0;</p><p> while( $row = SQLSRV_FETCH_ARRAY( $stmt, SQLSRV_FETCH_ASSOC) ) {</p><p> echo "<td>"; ?></p><p> <div class="newVisitor"></p><p> <a href="#" class="name tip" title="Edit user"></p><p> <?php echo $row["Firstname"]. ' ' .$row["Middlename"]. ' ' .$row["Lastname"]; ?></p><p> </a></p><p> </p><p> <?php if ($row['Available'] == 1) { ?><div class="status signedin">Signed In</div><?php }</p><p> else if ($row['Available'] == 2) { ?><div class="status signedout">Signed Out</div><?php }</p><p> else if ($row['Available'] == 3) { ?><div class="status signedunknown">Unknown</div><?php } ?></p><p> </div></p><p> </div></p><p> </div></p><p><?php echo "</td>";</p><p> $item++;</p><p> if ($item % 1 == 0) { echo '</tr><tr>'; } ?></p><p> <div id="clearfix"></div></p><p> </div></p><p></p><p></p><p></p><p> </p><p></p><p> </p><p> <?php }</p><p> echo "</table> ";</p><p> sqlsrv_free_stmt( $stmt);</p><p> </p><p> </p><p>?>[/CODE]</p><p></p><p>Thanks in advance!</p></blockquote><p></p>
[QUOTE="Skythrust, post: 454016, member: 87030"] 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; [URL]http://prntscr.com/poj3j3[/URL] 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; [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>[/CODE] Database Value Code; [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); ?>[/CODE] Thanks in advance! [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
PHP - view in column
Top