Having searched the forums meticulously I am faced with a familiar problem in displaying searched images from my phpmyadmin database. This is my code:
<?php require_once('Connections/Dictionary2.php'); ?>
<?php require_once('Connections/Dictionary2.php'); ?>
<?php require_once('Connections/Dictionary2.php'); ?>
<?php require_once('Connections/Dictionary2.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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_rsdef2 = 10;
$pageNum_rsdef2 = 0;
if (isset($_GET['pageNum_rsdef2'])) {
$pageNum_rsdef2 = $_GET['pageNum_rsdef2'];
}
$startRow_rsdef2 = $pageNum_rsdef2 * $maxRows_rsdef2;
$colname_rsdef2 = "-1";
if (isset($_POST['search_name'])) {
$colname_rsdef2 = $_POST['search_name'];
}
mysql_select_db($database_Dictionary2, $Dictionary2);
$query_rsdef2 = sprintf("SELECT search_name, definition FROM `dictionary` WHERE search_name = %s", GetSQLValueString($colname_rsdef2, "text"));
$query_limit_rsdef2 = sprintf("%s LIMIT %d, %d", $query_rsdef2, $startRow_rsdef2, $maxRows_rsdef2);
$rsdef2 = mysql_query($query_limit_rsdef2, $Dictionary2) or die(mysql_error());
$row_rsdef2 = mysql_fetch_assoc($rsdef2);
if (isset($_GET['totalRows_rsdef2'])) {
$totalRows_rsdef2 = $_GET['totalRows_rsdef2'];
} else {
$all_rsdef2 = mysql_query($query_rsdef2);
$totalRows_rsdef2 = mysql_num_rows($all_rsdef2);
}
$totalPages_rsdef2 = ceil($totalRows_rsdef2/$maxRows_rsdef2)-1;
$maxRows_rsdef3 = 10;
$pageNum_rsdef3 = 0;
if (isset($_GET['pageNum_rsdef3'])) {
$pageNum_rsdef3 = $_GET['pageNum_rsdef3'];
}
$startRow_rsdef3 = $pageNum_rsdef3 * $maxRows_rsdef3;
$colname_rsdef3 = "-1";
if (isset($_POST['search_name'])) {
$colname_rsdef3 = $_POST['search_name'];
}
mysql_select_db($database_Dictionary2, $Dictionary2);
$query_rsdef3 = sprintf("SELECT search_name, word_code, "http://xxx.co.uk/public_html/Images/Horse1.jpg" FROM `dictionary` WHERE search_name = %s", GetSQLValueString($colname_rsdef3, "text"));
$query_limit_rsdef3 = sprintf("%s LIMIT %d, %d", $query_rsdef3, $startRow_rsdef3, $maxRows_rsdef3);
$rsdef3 = mysql_query($query_limit_rsdef3, $Dictionary2) or die(mysql_error());
$row_rsdef3 = mysql_fetch_assoc($rsdef3);
if (isset($_GET['totalRows_rsdef3'])) {
$totalRows_rsdef3 = $_GET['totalRows_rsdef3'];
} else {
$all_rsdef3 = mysql_query($query_rsdef3);
$totalRows_rsdef3 = mysql_num_rows($all_rsdef3);
}
$totalPages_rsdef3 = ceil($totalRows_rsdef3/$maxRows_rsdef3)-1;
?><!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<style type="text/css">
<!--
this spits out the following error:
Parse error: syntax error, unexpected T_STRING in /home/stalkio/public_html/results4d.php on line 159
Lines 158 - 162
mysql_select_db($database_Dictionary2, $Dictionary2);
$query_rsdef3 = sprintf("SELECT search_name, word_code, "http://xxx.co.uk/public_html/Images/Horse1.jpg" FROM `dictionary` WHERE search_name = %s", GetSQLValueString($colname_rsdef3, "text"));
$query_limit_rsdef3 = sprintf("%s LIMIT %d, %d", $query_rsdef3, $startRow_rsdef3, $maxRows_rsdef3);
$rsdef3 = mysql_query($query_limit_rsdef3, $Dictionary2) or die(mysql_error());
$row_rsdef3 = mysql_fetch_assoc($rsdef3);
Can anyone see what is up?? - I just want to show the searched for images.