Foros del Web » Programando para Internet » PHP »

Warning: mysql_fetch_object(): plop!

Estas en el tema de Warning: mysql_fetch_object(): plop! en el foro de PHP en Foros del Web. hola tengo el sigiente error y no entiendo por que me lo tira Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in ...
  #1 (permalink)  
Antiguo 23/05/2008, 09:36
Avatar de a83
a83
 
Fecha de Ingreso: noviembre-2005
Ubicación: Santiago de chile
Mensajes: 637
Antigüedad: 18 años, 5 meses
Puntos: 1
Exclamación Warning: mysql_fetch_object(): plop!

hola tengo el sigiente error y no entiendo por que me lo tira


Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\noticia\muestranoticia.php on line 58



este es el cod
?>
Código PHP:
<? 
    
//muestro los datos en un bucle 
    
$num_filas 0
    while (
$damefila=mysql_fetch_object($resultid)) 
    { 
?>
  #2 (permalink)  
Antiguo 23/05/2008, 09:42
Avatar de Kaiser  
Fecha de Ingreso: febrero-2001
Ubicación: Heredia, Costa Rica
Mensajes: 239
Antigüedad: 23 años, 2 meses
Puntos: 1
Respuesta: Warning: mysql_fetch_object(): plop!

mandanos el query que tienes en $resultid.
__________________
http://www.abdicar.com - Undisputed Hosting Leader!
  #3 (permalink)  
Antiguo 23/05/2008, 09:45
Avatar de a83
a83
 
Fecha de Ingreso: noviembre-2005
Ubicación: Santiago de chile
Mensajes: 637
Antigüedad: 18 años, 5 meses
Puntos: 1
Respuesta: Warning: mysql_fetch_object(): plop!

Cita:
Iniciado por Kaiser Ver Mensaje
mandanos el query que tienes en $resultid.
mira lo solucione pero ahora no me graba la info que quero que quede en la base de datos solo me sube la foto a la carpeta que le asigne y lo mas extrano que no manda ningun error

este es el cod


Código PHP:
<a href="muestranoticia.php">Muestra
</a>
<?  
 

$dbhost
="******";  // host del MySQL (generalmente localhost)
$dbusuario="root"// aqui debes ingresar el nombre de usuario
                      // para acceder a la base
$dbpassword=""// password de acceso para el usuario de la
                      // linea anterior
$db="noticias";        // Seleccionamos la base con la cual trabajar


//datos del arhivo  
$nombre_archivo $HTTP_POST_FILES["userfile"]["name"];  
$tipo_archivo $HTTP_POST_FILES["userfile"]["type"];  
$tamano_archivo $HTTP_POST_FILES["userfile"]["size"];  

//compruebo si las características del archivo son las que deseo  

if (!((strpos($tipo_archivo"gif") || strpos($tipo_archivo"jpeg")) && (    $tamano_archivo 100000))) 
{  
    echo 
"La extensión o el tamaño de los archivos no es correcta. <br><br><table><tr><td><li>Se permiten archivos .gif o .jpg<br><li>se permiten archivos de 100 Kb máximo.</td></tr></table>"
?> 
    <script language="javascript"> 
        setTimeout("url()",3000); 
        function url() 
        { 
        window.history.back(); 
        } 
    </script>            
<?     

else 
{  
    
$nom_img$nombre_archivo
     
    
$directorio 'fotos'

    if (
move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'],$directorio "/" $nom_img)) 
    {  
            
$diaactualdate("d");  
        
$mesactualdate("m");  
        
$anoactualdate("Y"); 
        
$fecha$diaactual "/" $mesactual "/" $anoactual
         
        
//NOS CONECTAMOS A LA BASE DE DATOS 

        
$link=mysql_connect($dbhost,$dbusuario,$dbpassword); 
        
$titulo trim($_POST['titulo']);
        
$mensaje trim($_POST['mensaje']);
        
$userfile trim($_POST['userfile']);
        
$fecha trim($_POST['fecha']);
        
$link=mysql_connect($dbhost,$dbusuario,$dbpassword);
        
//$con = mysql_connect("localhost","root","");
                         
        
$query="INSERT INTO noticias (titulo,mensaje,userfile,fecha) VALUES ('$titulo','$mensaje','$userfile','$fecha')";  // esta es la linea 49
        
        
$result=mysql_db_query($database,$query,$link); 
         
        if(
mysql_affected_rows($link)) 
        {  
            echo 
"Noticia ingresada correctamente";  
             
        } else  
        {  
            echo 
"Error introduciendo la Noticia";  
        } 
/* Cierre del else */  




    

    else 
    { 
        echo 
"error al subir la foto"
    } 


?>
  #4 (permalink)  
Antiguo 23/05/2008, 09:47
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: Warning: mysql_fetch_object(): plop!

puedes postear el codigo que tenias anteriormente??? o ya lo perdiste?
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #5 (permalink)  
Antiguo 23/05/2008, 09:49
Avatar de Kaiser  
Fecha de Ingreso: febrero-2001
Ubicación: Heredia, Costa Rica
Mensajes: 239
Antigüedad: 23 años, 2 meses
Puntos: 1
Respuesta: Warning: mysql_fetch_object(): plop!

Me imagino que con grabar, entendemos subir a la base de datos con:

$query="INSERT INTO noticias (titulo,mensaje,userfile,fecha) VALUES ('$titulo','$mensaje','$userfile','$fecha')"; // esta es la linea 49

Lo primero es agregarle la salida para errores al query:

$query="INSERT INTO noticias (titulo,mensaje,userfile,fecha) VALUES ('$titulo','$mensaje','$userfile','$fecha')" or die(mysql_error());// esta es la linea 49

Ahora si, ahi no tenes ningún error que nos pueda indicar un error en el SQL o en la base de datos, verifiquemos que esta llegando la info:

echo "INSERT INTO noticias (titulo,mensaje,userfile,fecha) VALUES ('$titulo','$mensaje','$userfile','$fecha')";

Y cualquier resultado nos lo pones acá.
__________________
http://www.abdicar.com - Undisputed Hosting Leader!
  #6 (permalink)  
Antiguo 23/05/2008, 10:24
Avatar de a83
a83
 
Fecha de Ingreso: noviembre-2005
Ubicación: Santiago de chile
Mensajes: 637
Antigüedad: 18 años, 5 meses
Puntos: 1
Respuesta: Warning: mysql_fetch_object(): plop!

no me funciona=-?


no me muestra ningun error y no me graba nada en la base de datos
  #7 (permalink)  
Antiguo 23/05/2008, 10:33
Avatar de Kaiser  
Fecha de Ingreso: febrero-2001
Ubicación: Heredia, Costa Rica
Mensajes: 239
Antigüedad: 23 años, 2 meses
Puntos: 1
Respuesta: Warning: mysql_fetch_object(): plop!

esta línea tienes que ponerla arriba de la línea 49:

echo "INSERT INTO noticias (titulo,mensaje,userfile,fecha) VALUES ('$titulo','$mensaje','$userfile','$fecha')";

sino te imprime nada, es que no estamos pasando efectivamente el IF:
if (move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'],$directorio . "/" . $nom_img))
__________________
http://www.abdicar.com - Undisputed Hosting Leader!
  #8 (permalink)  
Antiguo 23/05/2008, 10:45
Avatar de a83
a83
 
Fecha de Ingreso: noviembre-2005
Ubicación: Santiago de chile
Mensajes: 637
Antigüedad: 18 años, 5 meses
Puntos: 1
Respuesta: Warning: mysql_fetch_object(): plop!

esto es lo que sale

INSERT INTO noticias (titulo,mensaje,userfile,fecha) VALUES ('','','','23/05/2008')Noticia ingresada correctamente
  #9 (permalink)  
Antiguo 23/05/2008, 10:52
Avatar de Kaiser  
Fecha de Ingreso: febrero-2001
Ubicación: Heredia, Costa Rica
Mensajes: 239
Antigüedad: 23 años, 2 meses
Puntos: 1
Respuesta: Warning: mysql_fetch_object(): plop!

ok, como puedes ver en VALUES ('','','' las variables no estan llevando info a tu script.

revisa que en el formulario los inputs y los espacios en general, tengan el nombre correcto:

$titulo = trim($_POST['titulo']);
$mensaje = trim($_POST['mensaje']);
$userfile = trim($_POST['userfile']);

Y además que estes mandando el form efectivamente por POST y no por GET.
__________________
http://www.abdicar.com - Undisputed Hosting Leader!
  #10 (permalink)  
Antiguo 23/05/2008, 11:07
Avatar de a83
a83
 
Fecha de Ingreso: noviembre-2005
Ubicación: Santiago de chile
Mensajes: 637
Antigüedad: 18 años, 5 meses
Puntos: 1
Respuesta: Warning: mysql_fetch_object(): plop!

QUE EXTRANO ESTE ES EL FORMULARIO Y ESTA BIEN


Código PHP:
<html>

<
head>
<
title>ENVIO DE NOTICIAS FL</title>
</
head>
<
script language="javascript">
function 
muestra()
{
document.form1.imagen.src=document.form1.userfilevalue;
}
</script>
<body>

<form name="form1" action="creanoticia.php" method="post"enctype="multipart/form-data">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="25%">&nbsp;</td>
<td width="50%" colspan="2">
<p align="center"><font color="#FF0000" size="5"><b>ENVIÓ DE NOTICIAS</b></font></td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">Titulo de Noticia</td>
<td width="25%">
<input type="text" name="titulo" size="17"></td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">Mensaje</td>
<td width="25%" rowspan="6">
<textarea name="mensaje" cols="25" rows="7"></textarea></td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%" rowspan="6" valign="middle">
  <p align="center"><img src="muestra/escudo.jpg" name="imagen" width="130" height="150" class="cajatexto1"></td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">
<p align="center"></td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">Buscar Imagen</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">
<input name="userfile" type="file" class="cajatexto1" onChange="muestra();" size="16" style="float: left">
<input type="hidden" name="MAX_FILE_SIZE" value="100000"></td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%" valign="top">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="50%" colspan="2">
<p align="center">
<input name="grabar" type="submit" class="cajatexto1" value="Enviar Datos" style="font-weight: bold">&nbsp;
<input type="reset" value="Cancelar" style="font-weight: bold"></td>
<td width="25%">&nbsp;</td>
</tr>
</table>

</form>

</body>

</html> 
  #11 (permalink)  
Antiguo 23/05/2008, 11:29
Avatar de Kaiser  
Fecha de Ingreso: febrero-2001
Ubicación: Heredia, Costa Rica
Mensajes: 239
Antigüedad: 23 años, 2 meses
Puntos: 1
Respuesta: Warning: mysql_fetch_object(): plop!

Si, aparentemente esta bien...

Entonces bueno, esto es lo bonito de depurar un problema.

Pasame una dirección donde pueda ver tu PHP.INI.

<?
phpinfo();
?>
__________________
http://www.abdicar.com - Undisputed Hosting Leader!
  #12 (permalink)  
Antiguo 23/05/2008, 12:20
Avatar de a83
a83
 
Fecha de Ingreso: noviembre-2005
Ubicación: Santiago de chile
Mensajes: 637
Antigüedad: 18 años, 5 meses
Puntos: 1
Pregunta Respuesta: Warning: mysql_fetch_object(): plop!

lo tengo de forma local no lo engo en un servidor:0
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 05:07.