Ver Mensaje Individual
  #6 (permalink)  
Antiguo 08/02/2011, 09:37
Tooj
 
Fecha de Ingreso: noviembre-2009
Mensajes: 64
Antigüedad: 14 años, 5 meses
Puntos: 1
Respuesta: problema con una función y un if

pues marcaba un warning en el uso de mysql_fetch_array

así que he intentado los siguiente, y ha funcionado, que creo es igual a la que angel aparicio había propuesto, je, tal vez algo estaba haciendo mal...

Código PHP:
function usegaleria() {
    global 
$id,$articulos;
    
$sql "SELECT post_usegaleria FROM $articulos WHERE id = '$id'"
    
$result mysql_query($sql) or die("Your SQL query: <br />$sql<br /><br />MySQL said:<br />".mysql_error());
    
$usegaleria mysql_fetch_array($result);
    return 
$usegaleria[0];  //Devuelve el valor, no lo imprimas 


además el include queda así:

Código PHP:

<?php if ( usegaleria() == 1) { ?>
        
        <?php include ("galeria.php"); ?>
        
        <?php ?>
gracias!! funciona!!