Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/03/2011, 13:56
bariedto
 
Fecha de Ingreso: diciembre-2010
Ubicación: Ica
Mensajes: 28
Antigüedad: 13 años, 4 meses
Puntos: 0
Inicio de secion

Buenas foreros del WED...bueno les escribo acerca de un reto(asi dice mi profe que le diga)..tengo un codigo php para inciar secion con unos usuarios que tengo en mi base de datos...pero la cuestion es que me arroga lo sgt:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\Jueves(12-11-2009)\conexion_usuario.php on line 45

Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\Jueves(12-11-2009)\conexion_usuario.php:18) in C:\wamp\www\Jueves(12-11-2009)\conexion_usuario.php on line 55


...Este es mi codigo php...

<html>
<head>
<title>Acceso</title>
</head>
<body>

<h1>Acceso Restringido</h1><br>
<hr>
<i>Por favor, ingrese su nombre de usuario y su clave </i><br>
<form name='f1' method='POST' action='conexion_usuario.php'>
<table border='0'>
<tr>
<td align='right'>Nombre de usuario</td>
<td align='left'><input type='textfield' name='txtNombre'></td>
</tr>

<tr>
<td align='right'>Clave</td>
<td align='left'><input type='password' name='txtclave'></td>
</tr>

<tr>
<td colspan='2' align='center'><input type='submit' value='ingresar'></td>
</tr>

</table>

<hr>

</form>
</body>
</html>

<?php

if($_POST)
{

$conexion=mysql_connect('localhost', 'root', '');
$nombre=$_POST['txtNombre'];
$clave=$_POST['txtclave'];
mysql_select_db('control', $conexion);
$sql="select * from usuarios where nombre='".$nombre."' and clave='".$clave."'";
$consulta=mysql_query($sql,$conexion);
$filas=mysql_num_rows($consulta);

if($filas > 0)
{
session_start();
$_SESSION['usuario']=$nombre;
header("Location:portal.php");//echo "Acceso Permitido";
}
else
{
header("Location:error.php");//echo "Acceso Denegado";
}
}
?>


Agradesco su ayuda a los foreros......de El pais el casi juamassss.....