hi,
im trying to do one college project where i have to display images horizontally. The image links are saved in the mysql db with the surname.
This is the script:
<?php require_once('Connections/conn1.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;
}
}
?>
<!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=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
$letter = isset($_GET['letter']) ? $_GET['letter'] : "0";
//alphabetical pagination links
echo '<div align="center"><b>';
foreach(range('A','Z') as $c){
($letter == $c)
? printf('%s ',$c)
: printf('<a href="?letter=%s">%s</a> ',$c,$c);
}
echo "</b></div><p>";
mysql_select_db($database_conn1, $conn1);
$query_rs1 = "SELECT * FROM tblvdo WHERE UCASE(surname) LIKE '{$letter}%' order by surname";
$rs1 = mysql_query($query_rs1, $conn1) or die(mysql_error());
?>
<table >
<tr>
<?php
$rs1_endRow = 0;
$rs1_columns = 4; // number of columns
$rs1_hloopRow1 = 0; // first row flag
do {
if($rs1_endRow == 0 && $rs1_hloopRow1++ != 0) echo "<tr>";
?>
<td><img src="<?php echo $row_rs1['imgurl']; ?>" width="100px"><td>
<?php $rs1_endRow++;
if($rs1_endRow >= $rs1_columns) {
?>
</tr>
<?php
$rs1_endRow = 0;
}
} while ($row_rs1 = mysql_fetch_assoc($rs1));
if($rs1_endRow != 0) {
while ($rs1_endRow < $rs1_columns) {
echo("<td> </td>");
$rs1_endRow++;
}
echo("</tr>");
}?>
</table>
</body>
</html>
<?php
mysql_free_result($rs1);
?>
In this project the alphabetical pagination will be pulling all the images horizontally with the particular letter from the surname field.
you can check live demo here: http://centos.uk.to/vdo3.php
The problem is if you click on letter B or S, there is a blank section of the same size as image before first image. I checked the source of html and found this line there and i dont no how its appearing
<td><img src="" width="100px"><td>
I will be grateful if someone can please help me finding the problem so that i dont get blank section before images.