web 2.0

How to use PHP & MySQL Display Multiple Column

How to use PHP & MySQL Display Multiple Column Learn PHP how to using PHP list data from mysql table and display result of multiple column.

ShotDev Focus:
- PHP & MySQL list data and multiple column.

Example

php_mysql_multiple_column.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","root") or die(mysql_error());
$objDB = mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM gallery";
$objQuery = mysql_query($strSQL);
echo"<table border=\"1\"  cellspacing=\"1\" cellpadding=\"1\"><tr>";
$intRows = 0;
while($objResult = mysql_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>
<?
mysql_close($objConnect);
?>

Create a php file and save to path root-path/myphp/

Run
http://localhost/myphp/php_mysql_multiple_column.php

Screenshot

PHP MySQL Display Multiple Column
.
.
.

Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.