Hi all,
Hopefully, this will make sense to people 🙂
I'm building a site for a friend, and I'm fairly new to PHP, so here goes.....
What I'm trying to do is display several images in a spiral pattern, this in itself is not a problem if I was using HTML, but future functionality demands that I use PHP and a database (Will need to upload new images, add comments etc. at a later date for each of the images.)
The problem I'm having is getting the information from the database to display.
Here's the php
<?php
$id= $_GET['id'];
//=====================================//
// Database Section
//=====================================//
// creates a new Common-Object-Model (COM) connection object
$adoCon = new COM("ADODB.Connection");
// the path to the folder holding this PHP script
$sHere = dirname(__FILE__);
// opens the connection using a standard Access2007 connection string
$adoCon-> Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=$sHere/dbase/test1.accdb");
$sSQL= "SELECT * FROM tblTest WHERE ID LIKE $id";
// searches the DB
$rsMain = $adoCon->Execute( $sSQL );
//=====================================//
// Outputs all the selected fields in the table "tblTest",
// processes each record until we reach the end of the recordset
$simgURL = $rsMain->Fields("URL")->value;
//
//
// // prints each of the fields
print "<img src='images/grid/$simgURL'>";
//=====================================//
// closes the recordset, frees up resources, kills all traces
// $rsMain->Close();
// $rsMain = null;
// closes the connection, frees up resources, kills all traces
// $adoCon->Close();
// $adoCon = null;
?>
This works fine when ran by itself. The problem comes when I try to use 'includes' now I'm pretty sure the problem is the includes itself, the error kinda tells me so.
So, here's how I'm trying it atm, but it seems as though passing ReadDB.php?id=2 is something that the includes command doesn't like.
<td><?php include("ReadDB.php?id=2"); ?></td>
I've also tried using the img src html tag (changing the PHP to fit), but with no luck.
Could someone point me in the right direction?
Also, because of the way the images will be layed out, the 'id=' part needs to be a static number.
Thanks
TheMightySpud