I'm totally stumped. I have done this literally a hundred times and I don't know why it won't work right now.
This code works on several pages and it works. The code is identical on several pages.
<?php
// Load PEAR DB
require 'DB.php';
require '../formhelpers.php';
require '../../dbConnect/dbConnect.php';
// Connect to the database
$db = DB::connect($connect);
if (DB::isError($db)) { die ("Can't connect: " . $db->getMessage()); }
// Set up automatic error handling
$db->setErrorHandling(PEAR_ERROR_DIE);
// Set up fetch mode: rows as objects
$db->setFetchMode(DB_FETCHMODE_ASSOC);
if ($_POST['_submit_check']) {
process_form();
}
?>
When I add this code the page does not work. I get
"Fatal error: Call to a member function on a non-object in /home/adrenali/public_html/admin/deleteImages.php on line 1"
These are the only two pieces of PHP code on the page. Everything else is plain HTML.
<?php
$imageId = $_GET['imageId'];
$sql = "SELECT imageId, path, main FROM images WHERE imageId = $imageId";
$row = $db->getRow($sql);
$image = $row['path'];
echo "<tr><td><img src=\"../$image\" height=\"80\" width=\"80\" /></td></tr>";
?>
I have to be missing something obvious. Any thoughts? Thanks!