Results 1 to 4 of 4

Thread: Need help with PHP script logic

  1. #1
    Join Date
    May 2008
    Posts
    248

    Need help with PHP script logic

    Hi
    I am trying to program for a login screen, I have succeeded somewhat but I am getting a blank screen. If you login with a user name and if it is wrong then it will directyou to a different page.
    Code:
    include("connectdb.php"); 
    
    $rRes = mysql_query( 
       sprintf(        
       "SELECT * FROM register WHERE email = '%s' LIMIT 1",        
       mysql_real_escape_string($_POST['myemail'])    
       )
       );
       if(1 !== mysql_num_rows($rRes))
       {    
       header('Location: wrong.php');    
       exit;
      }
    
    $aRec = mysql_fetch_assoc($rRes);
     printf(    
       '
        <strong>Type:</strong>%s<br />    
        <strong>State:</strong>%s<br />    
        <strong>Area:</strong>%s<br />    
        <strong>Description:</strong>%s<br />        
         <strong>ID:</strong>%s<br /> 
        ',
        $aRec['type'],    
        $aRec['state'],    
        $aRec['area'],    
        $aRec['desc'],        
        $aRec['ID']
        
     );
    Any advice or suggestion on this. Thanks in advance.

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Need help with PHP script logic

    Hi
    I think you should try echoing out the result of mysql_num_rows($rRes) to see what you get the value.
    Or you can try changing this
    Code:
    if(1 !== mysql_num_rows($rRes))
    To this:
    Code:
    if (intval(mysql_num_rows($rRes)) < 1)
    This may work check it.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Need help with PHP script logic

    Hi
    I feel that there is a problem in the following line of your program, can you please try replacing it.
    now it is
    Code:
    if(1 !== mysql_num_rows($rRes))
    try changing to
    Code:
    if (mysql_num_rows($rRes) == 0)

  4. #4
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Need help with PHP script logic

    Hi
    If you need you can try the following code
    Code:
    include("connectdb.php"); 
    
    if($_POST && !empty($_POST['myemail']))
    {
    	$email=mysql_real_escape_string($_POST['myemail']);
    	$rRes = mysql_query( "SELECT * FROM register WHERE email = '$email' LIMIT 1");       
    	if( mysql_num_rows($rRes) > 0)
    	{
    		$aRec = mysql_fetch_assoc($rRes);
    		echo " <strong>Type:</strong>$aRec['type']<br />    
    			   <strong>State:</strong>$aRec['state']<br />    
    			   <strong>Area:</strong>$aRec['area']<br />    
    			   <strong>Description:</strong>$aRec['desc']<br />        
    			   <strong>ID:</strong>$aRec['ID']<br /> ";
    	}
    	else
    	{ 
    		header('Location: wrong.php');    
    	}
    }
    else
    	echo 'Nothing Posted!';
    Any more problem do post back.

Similar Threads

  1. Beat Pad for Logic Pro 9?
    By $Iain$ in forum Windows Software
    Replies: 2
    Last Post: 17-02-2012, 06:01 PM
  2. How to do DLL injection logic
    By Thenral in forum Software Development
    Replies: 5
    Last Post: 27-06-2011, 10:30 AM
  3. Replacement for Volume Logic
    By Nadiaa in forum Operating Systems
    Replies: 7
    Last Post: 20-03-2011, 06:01 PM
  4. Information about Dolby Pro Logic
    By Gokul20 in forum Hardware Peripherals
    Replies: 8
    Last Post: 15-07-2010, 06:51 AM
  5. Need help for Main Source of Logic Design in Visual Logic software
    By PsYcHo 1 in forum Software Development
    Replies: 4
    Last Post: 16-01-2010, 07:17 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,945,052.86754 seconds with 16 queries