web 2.0

How to use PHP & AdoDB Display Multiple Column

How to use PHP & AdoDB Search Data This tutorials/scripts developing with the PHP Scrips Using ADO  list data from Database table and display result of multiple column.

ShotDev Focus:
- PHP & AdoDB list data from database and multiple column.

Example

php_ado_column.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
$strConn = new COM("ADODB.Connection") or die("Cannot start ADO");
$strConn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("db/mydatabase.mdb"));
$strSQL = "SELECT * FROM gallery ";
$objRec = new COM("ADODB.Recordset");
$objRec->Open($strSQL, $strConn, 1,3);

if($objRec->EOF)
{
echo "Not found Record.";
}
else
{

$PageLen = 4;
$PageNo = $_GET["Page"];
if(!$PageNo)
{
$PageNo = 1;
}
$TotalRecord = $objRec->RecordCount();
$objRec->PageSize = $PageLen;
$TotalPage = $objRec->PageCount();
$objRec->AbsolutePage = $PageNo;

echo"<table border=\"1\"  cellspacing=\"1\" cellpadding=\"1\"><tr>";
$intRows = 0;
while (!($objRec->EOF) and $No < $PageLen)
{
echo "<td>";
$intRows++;
?>
<center>
<img src="shotdev/<?=$objRec->Fields["Picture"]->Value;?>"><br>
<?=$objRec->Fields["GalleryName"]->Value;?>
<br>
</center>
<?
echo"</td>";
if(($intRows)%2==0)
{
echo"</tr>";
}
$objRec->MoveNext();
$No = $No + 1;
}
echo"</tr></table>";
?>
<br>
Total : <?=$TotalRecord?> Page <?=$PageNo?> All Page <?=$TotalPage?>
<? if($PageNo > 1){ ?>
<a href="<?=$_SERVER[SCRIPT_NAME];?>?Page=1"><< First</a>
<a href="<?=$_SERVER[SCRIPT_NAME];?>?Page=<?=$PageNo-1?>">< Back</a>
<? }?>
<? if($PageNo < $TotalPage) { ?>
<a href="<?=$_SERVER[SCRIPT_NAME];?>?Page=<?=$PageNo+1?>">Next ></a>
<a href="<?=$_SERVER[SCRIPT_NAME];?>?Page=<?=$TotalPage?>">Last >></a>
<?}?>
<br>
Go to
<? for($intID=1;$intID<=$TotalPage;$intID++){?>
<? if($intID == $PageNo){?>
<b><?=$intID?></b>
<?}else{?>
<a href="<?=$_SERVER[SCRIPT_NAME];?>?Page=<?=$intID?>"><?=$intID?></a>
<?}?>
<?}?>
</body>
</html>
<?
}
$objRec->Close();
$strConn->Close();
$strConn = null;
?>

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

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

Screenshot

PHP & AdoDB 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 ...

One Response to “How to use PHP & AdoDB Display Multiple Column”

  1. 2barrack…

Leave a Reply

You must be logged in to post a comment.