Foros del Web » Programando para Internet » PHP »

[SOLUCIONADO] Warning: mysql_mysql_num_rows() expects parameter 1 to be resource, boolean given in

Estas en el tema de Warning: mysql_mysql_num_rows() expects parameter 1 to be resource, boolean given in en el foro de PHP en Foros del Web. Me da el Siguiente Warning: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C De igual forma el ejecuta la consulta y ...
  #1 (permalink)  
Antiguo 11/10/2013, 14:21
 
Fecha de Ingreso: septiembre-2007
Mensajes: 40
Antigüedad: 16 años, 7 meses
Puntos: 0
Warning: mysql_mysql_num_rows() expects parameter 1 to be resource, boolean given in

Me da el Siguiente Warning:

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C

De igual forma el ejecuta la consulta y agrega pero me da ese warning, a continuación el código

Código PHP:
Ver original
  1. <?php require_once('Connections/config.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.   if (PHP_VERSION < 6) {
  7.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8.   }
  9.  
  10.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12.   switch ($theType) {
  13.     case "text":
  14.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15.       break;    
  16.     case "long":
  17.     case "int":
  18.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19.       break;
  20.     case "double":
  21.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22.       break;
  23.     case "date":
  24.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25.       break;
  26.     case "defined":
  27.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28.       break;
  29.   }
  30.   return $theValue;
  31. }
  32. }
  33.  
  34. mysql_select_db($database_config, $config);
  35. $query_registroPersona = "SELECT * FROM docentes";
  36. $registroPersona = mysql_query($query_registroPersona, $config) or die(mysql_error());
  37. $row_registroPersona = mysql_fetch_assoc($registroPersona);
  38. $totalRows_registroPersona = mysql_num_rows($registroPersona);
  39.  
  40. mysql_connect('localhost','root','')or die ('Ha fallado la conexión: '.mysql_error());
  41.  
  42. mysql_select_db('coordinacion')or die ('Error al seleccionar la Base de Datos: '.mysql_error());
  43.  
  44.  
  45.  
  46. $cedula=$_POST['cedula'];
  47.  
  48. $nombre=$_POST['nombre'];
  49.  
  50. $apellido=$_POST['apellido'];
  51.  
  52. $correo1=$_POST['correo1'];
  53.  
  54. $correo2=$_POST['correo2'];
  55.  
  56. $bloque=$_POST['bloque'];
  57.  
  58. $telefono=$_POST['telefono'];
  59.  
  60. $checkid = mysql_query("SELECT * FROM persona WHERE cedula='$cedula'");
  61.  
  62. $id_exist = mysql_num_rows($checkid);          
  63.  
  64. if ($id_exist>0) {
  65.  
  66.                
  67.  
  68. echo('<script language="JavaScript" >');
  69.  
  70. echo ('alert(" El numero de Cedula ya Esta Registrado.");');
  71.  
  72. echo('location.replace("ingreso.php")');
  73.  
  74. echo('</script>');
  75.  
  76. }else{
  77.    
  78. $query = 'INSERT INTO docentes (cedula,nombre,apellido,correo1,correo2,bloque,telefono) VALUES (\''.$cedula.'\',\''.$nombre.'\',\''.$apellido.'\',\''.$correo1.'\',\''.$correo2.'\',\''.$bloque.'\',\''.$telefono.'\')';
  79.  
  80. mysql_query($query) or die(mysql_error());
  81.  
  82.  
  83. ?>


El Error me lo muestra en la consulta donde verifico con un select si existe esa cedula
  #2 (permalink)  
Antiguo 11/10/2013, 14:30
Avatar de andresdzphp
Colaborador
 
Fecha de Ingreso: julio-2011
Ubicación: $this->Colombia;
Mensajes: 2.749
Antigüedad: 12 años, 9 meses
Puntos: 793
Respuesta: Warning: mysql_mysql_num_rows() expects parameter 1 to be resource, boolea

Agrega aquí:

Código PHP:
Ver original
  1. $checkid = mysql_query("SELECT * FROM persona WHERE cedula='$cedula'");

el

Código PHP:
Ver original 

a ver que error te dice Mysql.

También imprime $cedula para ver si está llegando correctamente.
__________________
Si sabemos como leer e interpretar el manual será mucho más fácil aprender PHP. En lugar de confiar en ejemplos o copiar y pegar - PHP
  #3 (permalink)  
Antiguo 11/10/2013, 14:33
 
Fecha de Ingreso: septiembre-2007
Mensajes: 40
Antigüedad: 16 años, 7 meses
Puntos: 0
Respuesta: Warning: mysql_mysql_num_rows() expects parameter 1 to be resource, boolea

Listo gracias por la ayuda ya lo solucione, era que estaba llamando a la tabla que no era, es decir dice que llamo a la tabla personas y no era esa al contrario era la de docentes, gracias por la ayuda.

Saludos..
  #4 (permalink)  
Antiguo 11/10/2013, 14:35
Avatar de andresdzphp
Colaborador
 
Fecha de Ingreso: julio-2011
Ubicación: $this->Colombia;
Mensajes: 2.749
Antigüedad: 12 años, 9 meses
Puntos: 793
Respuesta: Warning: mysql_mysql_num_rows() expects parameter 1 to be resource, boolea

De nada, te recomiendo que des una leída a esto:

Anuncio: Extensión MySQL se considera obsoleta

Saludos.
__________________
Si sabemos como leer e interpretar el manual será mucho más fácil aprender PHP. En lugar de confiar en ejemplos o copiar y pegar - PHP

Etiquetas: boolean, expects, mysql, parameter, registro, resource, select, sql, warning
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 18:33.