• Portada
    • Recent
    • Users
    • Register
    • Login

    Ayuda: Validacion usuario PHP+MySQL

    Scheduled Pinned Locked Moved Software
    1 Posts 1 Posters 2.4k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • albertpgA Offline
      albertpg
      last edited by

      Buenas, tengo un problema al validar un usuario en una base de datos. Este es el codigo de validacion:

       connect(); 		$conn = mysql_connect("localhost","xarxes","3A2Mu") or die ("Error!"); 		mysql_select_db("x71",$conn) or die ("Error");  		$usuari = $_POST["nom"]; 		$passwd = $_POST["pass"];  		$cadSQL = mysql_query("SELECT * FROM Usuaris WHERE Nom ='$usuari' and Password='$passwd'"); 		$dades = mysql_query($cadSQL); 		$linia = mysql_fetch_assoc($dades); 		$n = mysql_num_rows($dades); 		//$resultat=$db->execSQL($sql); 		if($n == 0) 		{ 			$_SESSION["login"] = false; 			echo " ";  			echo "  "; 		} 		else{ 			$_SESSION["login"]=true; 			echo "  "; 		}  	} } ?> 

      Y al darle a aceptar en la ventana de login me salta este error:

      Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/xarxes/x71/web/xhtml/validate.php on line 20  Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/xarxes/x71/web/xhtml/validate.php on line 21 

      Seguido del alert "Usuario incorreto", y el usuario SI que existe.

      Alguna ayudita??

      Gracias!

      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • 1 / 1
      • First post
        Last post

      Foreros conectados [Conectados hoy]

      4 usuarios activos (1 miembros y 3 invitados).
      febesin, pAtO, smith

      Estadísticas de Hardlimit

      Los hardlimitianos han creado un total de 543.7k posts en 62.9k hilos.
      Somos un total de 35.0k miembros registrados.
      JerryOld ha sido nuestro último fichaje.
      El récord de usuarios en linea fue de 123 y se produjo el Thu Jan 15 2026.