Ver Mensaje Individual
  #2 (permalink)  
Antiguo 15/04/2008, 14:46
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años, 8 meses
Puntos: 2135
Re: Problema con return se pierde el valor

Prueba esto:
Código PHP:
function get_id_cat_ant($id_cat_city)
{
    while (
$id_cat_city!=0)
    {
        
$query_cat_ant='select id_cat from td_categorias where id_cat='.$id_cat_city;
        
$res_cat_ant=mysql_query($query_cat_ant) or die ("Hay error en funcion_cat_ant".mysql_error());
        while(
$row_cat_ant=mysql_fetch_array($res_cat_ant))
        {
            if (
$row_cat_ant['id_cat_ant']==0)
            {
            
$city=$row_cat_ant['id_cat'];
            }
            
            
$id_cat_city=$row_cat_ant['id_cat_ant'];
        }
    }
    echo 
$city;
    return 
$city;

y verifica si te imprime el valor correcto de $city.

Saludos.