Jump to content

where is the error


lmcm2008

Recommended Posts

Hi: I have an error that will be very basic, but I don´t see it...

 

I have this first php:

<?php
session_start();

require ("connecting.php");

require ("searchprofile.php");

connect();


$miuser=$_SESSION['usu'];
$supas=$_SESSION['pas'];

echo " Welcome: $miuser $supas<br />";

if ( busca_perfil_activo($miuser)==1)
	{
	echo "show $miuser<br />";
	muestra_perfil($miuser);
	} else
		{
		echo "creating  $miuser<br />";
		crea_perfil($miuser);
		}


mysql_close();
?>

Ok.... maybe the problem is here:

if ( busca_perfil_activo($miuser)==1)
	{
	echo "show $miuser<br />";
	muestra_perfil($miuser);
	} else
		{
		echo "creating  $miuser<br />";
		crea_perfil($miuser);
		}

and the function "busca_perfil_activo($miuser) is the following:

function busca_perfil_activo($activo)
	{

	$sql="SELECT * FROM perfil WHERE USUARIO='$activo' ";
	$result = mysql_query($sql);	
	$totalreg=mysql_num_rows($result);

	if($result == 1)
        {
            return 1;
        }
        else
        {

            return 0;
        }
	}

Why this function always return 0 ?? I have a record that is ok with the search... and will return 1 in that case, but never do it...

Why?? Can you help me??

 

thanks.

 

 

Link to comment
https://forums.phpfreaks.com/topic/280774-where-is-the-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.