How to use PHP & SQL Server (mssql) Display Multiple Column Learn / tutorial php programming how to using PHP list data from SQL Server table and display result of multiple column.
ShotDev Focus:
- PHP & SQL Server list data and multiple column.
Example
php_sqlserver_multiple_column.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <? $objConnect = mssql_connect("localhost","sa",""); $objDB = mssql_select_db("mydatabase"); $strSQL = "SELECT * FROM gallery"; $objQuery = mssql_query($strSQL); echo"<table border=\"1\" cellspacing=\"1\" cellpadding=\"1\"><tr>"; $intRows = 0; while($objResult = mssql_fetch_array($objQuery)) { echo "<td>"; $intRows++; ?> <center> <img src="shotdev/<?=$objResult["Picture"];?>"><br> <?=$objResult["GalleryName"];?> <br> </center> <? echo"</td>"; if(($intRows)%2==0) { echo"</tr>"; } } echo"</tr></table>"; ?> </body> </html> <? mssql_close($objConnect); ?>
Create a php file and save to path root-path/myphp/
Run
http://localhost/myphp/php_sqlserver_multiple_column.php
Screenshot