Hi all,
Really strange thing. I'm using Dreamweaver CS5.5 to build a site for uni. I am creating a testimonial page with an upload funtion. The upload function is working fine however I'm having trouble displaying the data. I've created a recordset and put each item in the area of the page I want it to display. I then created a repeat region which repeats the rows of the database as many times as you require.
When I test the recordset SQL it runs fine however once I create the repeat region I get this error in the browser:
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 'LIMIT 0, 15' at line 1
Now I have not got a clue what this means or how to check it. Can anyone help me? Need this as soon as possible if anyone can help. This is my code:
<?php require_once('Connections/DohertyDecoratingLtd.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$maxRows_rstGallery = 15;
$pageNum_rstGallery = 0;
if (isset($_GET['pageNum_rstGallery'])) {
$pageNum_rstGallery = $_GET['pageNum_rstGallery'];
}
$startRow_rstGallery = $pageNum_rstGallery * $maxRows_rstGallery;
mysql_select_db($database_DohertyDecoratingLtd, $DohertyDecoratingLtd);
$query_rstGallery = "SELECT tblgallery.imageid, tblgallery.imagetitle, tblgallery.imagefilepath, tbljobcat.CategoryName FROM tbljobcat INNER JOIN tblgallery ON tbljobcat.catid=tblgallery.jobcat; ";
$query_limit_rstGallery = sprintf("%s LIMIT %d, %d", $query_rstGallery, $startRow_rstGallery, $maxRows_rstGallery);
$rstGallery = mysql_query($query_limit_rstGallery, $DohertyDecoratingLtd) or die(mysql_error());
$row_rstGallery = mysql_fetch_assoc($rstGallery);
if (isset($_GET['totalRows_rstGallery'])) {
$totalRows_rstGallery = $_GET['totalRows_rstGallery'];
} else {
$all_rstGallery = mysql_query($query_rstGallery);
$totalRows_rstGallery = mysql_num_rows($all_rstGallery);
}
$totalPages_rstGallery = ceil($totalRows_rstGallery/$maxRows_rstGallery)-1;
?>
Head, body etc.
<?php do { ?>
<a href="<?php echo $row_rstGallery['imagefilepath']; ?>" rel="shadowbox" title="<?php echo $row_rstGallery['imagetitle']; ?>"><img src="<?php echo $row_rstGallery['imagefilepath']; ?>" width="100" height="70" /></a>
<?php } while ($row_rstGallery = mysql_fetch_assoc($rstGallery)); ?>