I have a code that works perfectly on another website, but in this one that is a renewal it is giving me problems, I attach the error and the code:
(!) SCREAM: Error suppression ignored for (!) Warning: mysql_num_rows () expects parameter 1 to be resource, boolean given in C: \ wamp \ www \ claromeconet.com \ components \ imagenes.php on line 3
Code:
<?php
$image_query = mysql_query("SELECT 'id','hash' FROM 'img_alq' WHERE 'estado'='1' AND 'idalq'='{$prop['id']}' ORDER BY 'orden' ASC;");
$images = mysql_num_rows($image_query);
?>
<div class="imagen-propiedad">
<div class="slider">
<?php if($images==0){
echo '<img src="/images/BannerProximamente200x150.png" />';
}
while($row_image=mysql_fetch_assoc($image_query)){
echo "<img src=\"/images/200x150.php?para=alq&id={$row_image['id']}&hash={$row_image['hash']}\" />";
}
mysql_free_result($image_query)?>
</div>
</div>
<?php if($images>1){ ?>
<script type="text/javascript">
$('#prop_<?php echo $prop['id'] ?> .slider').slidesjs({
width:200,
height:150,
navigation:{active:false},
play:{interval:5000,auto:true},
fade:{speed:300}
});
</script>
<?php } ?>
Code 200x150.php:
<?php
include('../../componentes/var.php');
set_time_limit(20);
if(isset($_GET['id']) and preg_match($expr_idusuario,$_GET['id'])){
if(isset($_GET['hash']) and preg_match($expr_hash_reg,$_GET['hash'])){
if(isset($_GET['para']) and preg_match("/^(alq|user|hotel|album|serv){1}$/",$_GET['para'])){
$query=mysql_query("SELECT '200x150', 'hash', 'estado' FROM 'img_{$_GET['para']}' WHERE 'id'='{$_GET['id']}' LIMIT 1;");
if(mysql_num_rows($query)==1){
$img=mysql_fetch_assoc($query);
if($img['hash']==$_GET['hash']){
if($img['estado']){
$expires = 60*60*8;
header("Pragma: public");
header("Cache-Control: maxage=".$expires);
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
header("Content-type: image/png");
echo $img['200x150'];
}else echo 'Deshabilitada.';
}else echo 'Hash incompatible.';
}else echo 'Sin resultados.';
}else echo 'Para erroneo.';
}else echo 'Hash erroneo.';
}else echo 'ID erroneo.';
?>
Basically what this code does is read in a table "img_alq" some images in BLOB format "200x150", then build a slider with the small js below.