You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Also if anyone has any best practices for image uploading - please let me know. Thanks.
<?php session_start();
include "sessionCheck.php";
sessionCheck();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/temp.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="Title" -->
<title>Whitworth Gallery></title>
<!-- InstanceEndEditable --><!-- InstanceBeginEditable name="HEAD" -->
<!-- InstanceEndEditable -->
<link type="text/css" rel="stylesheet" media="screen" href="../Templates/styles/main.css" />
<link type="text/css" rel="stylesheet" media="screen" href="../Templates/styles/fonts.css" />
<script type="text/javascript" src="../Templates/deploy/swfobject.js"></script>
</head>
<body>
<div id="logo">Whitworth Gallery</div>
<div id="nav">
<ul>
<li><a href="../index.html">Home</a></li>
<li><a href="../about.html">About</a></li>
<li><a href="../store/fineArt.php">Fine Art</a></li>
</ul>
</div>
<!-- InstanceBeginEditable name="body" -->
<div id="bodyArea">
<div id="sort">
<p>Admin >></p>
<ul>
<li><a href="index.php">Admin Index</a></li>
<li><a href="add.html">Create New Peice</a></li>
<li><a href="addNews.html">New News Post</a></li>
</ul>
<br class="clear" />
</div>
<?php
/**************************************************************************/
// WhitworthGallery.org
// --------------------
// display.php
// January 15th, 2009
// Greg Whitworth
/**************************************************************************/
// DOCUMENT NOTES
//--------------------------------------------------------------------------
// DESCRIPTION
// -----------
// This script shows the more info section of each item.
// DEFINING DIAGRAM
// ----------------
// • Variable Definitions
// • PROCESS
// • OUTPUT
/**************************************************************************/
// INCLUDES
//--------------------------------------------------------------------------
include "sqlConnection.php";
/**************************************************************************/
// VARIABLE DEFINITIONS
//--------------------------------------------------------------------------
$pageId = $_GET['pageId'];
$fields = "id, title, description, medium, price, date, img, imgLg, edition, subject, orientation";
$result = mysql_query("SELECT $fields FROM Art WHERE id=$pageId") or die(mysql_error());
/**************************************************************************/
// PROCESS
//--------------------------------------------------------------------------
// Checks to see if image has been uploaded
if (isset($_POST['thumbSubmit'])) {
if (is_uploaded_file($imgfile)) {
$uploaddir = "http://www.whitworthgallery.org/images/gallery/";
$newfile = $uploaddir . "/" . $imgfile ."_small";
if (!copy($imgfile, $newfile)) {
// if an error occurs the file could not
// be written, read or possibly does not exist
print "Error Uploading File.";
exit();
}
}
}
// Checks to see if the large image was sent and uploaded
if (isset($_POST['imgLgSubmit'])) {
if (is_uploaded_file($imgfile)) {
$uploaddir = "http://www.whitworthgallery.org/images/gallery";
$newfile = $uploaddir . "/" . $imgfile;
if (!copy($imgfile, $newfile)) {
// if an error occurs the file could not
// be written, read or possibly does not exist
print "Error Uploading File.";
exit();
}
}
}
while($row = mysql_fetch_array($result)){
/**************************************************************************/
// OUTPUT
//--------------------------------------------------------------------------
print "<div id=\"displayContainer\">";
print "<form id=\"edit\" action=\"edit_insert.php\" method=\"post\">";
print "<img src=\"../images/gallery/".$row{'imgLg'}."\"><br/>";
print "<input type=\"text\" name=\"title\" id=\"title\" value=\"".$row{'title'}."\"><br/>";
print "<textarea name=\"description\" id=\"description\" cols=\"50\" rows=\"5\">".$row{'description'}."</textarea><br/>";
print "<table cellspacing=\"0\" cellpadding=\"0\" id=\"admin\">";
print "<tr>";
print "<td>ID: </td>";
print "<td><input type=\"text\" name=\"id\" readonly value=\"".$row{'id'}."\"></td>";
print "</tr>";
print "<tr>";
print "<td>Medium: </td>";
print "<td><input type=\"text\" name=\"medium\" value=\"".$row{'medium'}."\"></td>";
print "</tr>";
print "<tr>";
print "<td>Price: </td>";
print "<td><input type=\"text\" name=\"price\" value=\"".$row{'price'}."\"></td>";
print "</tr>";
print "<tr>";
print "<td>Edition Size: </td>";
print "<td><input type=\"text\" name=\"edition\" value=\"".$row{'edition'}."\"> Leave blank if not applicable</td>";
print "</tr>";
print "<tr>";
print "<td>Orientation: </td>";
print "<td><input type=\"radio\" value=\"horizontal\" name=\"orientation\" /> Horizontal <input type=\"radio\" value=\"vertical\" name=\"orientation\" /> Vertical</td>";
print "</tr>";
print "<tr>";
print "<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"Submit\" /></td>";
print "</tr>";
print "</table>";
print "<br/>";
print "<br/>";
print "<br style=\"clear: both\" />";
print "</form>";
// Upload thumbnail to temporary folder
print "<form id=\"thumbUpload\" action=\"".$_SERVER['PHP_SELF']."\" method=\"post\" enctype=\"multipart/form-data\">";
print "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"25000\">Upload Thumbnail: <input type=\"file\" name=\"thumbnail\"><br/>";
print "<input type=\"submit\" value=\"Upload Thumb\" name=\"thumbSubmit\">";
print "</form>";
// Upload thumbnail to temporary folder
print "<form id=\"imgLgUpload\" action=\"".$_SERVER['PHP_SELF']."\" method=\"post\" enctype=\"multipart/form-data\">";
print "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"25000\">Upload Image: <input type=\"file\" name=\"imgLg\"><br/>";
print "<input type=\"submit\" value=\"Upload Image\" name=\"imgLgSubmit\">";
print "</form>";
print "</div>";
}
/**************************************************************************/
// CHANGE LOG
//--------------------------------------------------------------------------
// GCW - Created php script show file based on pageId
?>
</div>
</div>
<!-- InstanceEndEditable -->
<div id="bottom">
Copyright GKW (2008). All Rights Reserved. Web Design & Development by GKW.
</div>
</body>
<!-- InstanceEnd --></html>

New Topic/Question
Reply




MultiQuote







|