img_inc.php
Código PHP:
<?php include('Connections/incomed.php');
// Variables de Configuración -----------------------------------
// Define el numero de Filas
$n_filas=3;
//***************************************************************
@$cat=$_REQUEST['id'];
//$cat=6;
$fotos = array();
$sql="SELECT * FROM imagenes where id_pro=".$producto_id." ORDER BY id ASC";
mysql_select_db ('incomed');
$sql_exec=mysql_query($sql);
/*while($row=mysql_fetch_assoc($sql_exec)){
$tottal=mysql_affected_rows(); // Calculo el numero total de itms a listar
}*/
$tottal=113;
// ------------------------------------------------------------------------------------------------------------------
$vert=$tottal/$n_filas;
$vert=round($vert);
?>
<table width="257" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="257" height="112"><table width="257" height="112" border="0" align="center" cellpadding="0" cellspacing="0">
<?php
$a=0;// Colocando el contador horizontal en 0
$i=1;// Colocando el contador vertical en 0
$w=0;//Colocando un contador para el mensaje de "No hay articulos en esta acategoria"
while($row=mysql_fetch_assoc($sql_exec)){
$w=w+1;
if ($a==0){
echo '<tr>';
}
$a=$a+1;
$fotos[$i.'-'.$a] = $row['img'];
echo "<td height='80' width='53' border='0' ><a href='verimagen.php?id=".$row['id']."'><img src='images2/".$row['img']."' width='80' height='53' border='0'/></a>";
$r=$a;// contador remanente para listar imagenes sin exceso
if ($a >= $n_filas) {
$a=0;// reiniciando el contador horizontal
$i=$i+1;// aumentando el contador vertical
echo '</tr>';
}
if (empty($row)) {
echo"<table width='0' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td width='257'><div align='center'>No hay articulos en esta categoria </div></td>
</tr>
</table>
";
break 1;}
}
echo '</td>';
?>
<?php /*if (empty($w)) {
echo"<table width='0' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td width='492'><div align='center'>No hay articulos en esta categoria </div></td>
</tr>
</table>
";
exit;}
*/?>
</table></td>
</tr>
</table>
verimagen.php
Código PHP:
<?php require_once('Connections/incomed.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;
}
}
$query_Recordset1 = sprintf("SELECT * FROM imagenes WHERE id = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $incomed) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style></head>
<img src="images2/<?php echo $row_Recordset1['img']; ?>" border="0" />
<?php
mysql_free_result($Recordset1);
?>
Gracias a todos...