SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Apr 2004
    Location
    UK
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A simple multiplication issue.

    I'm passing the following:

    Code:
    		if(isset($_POST['posted']))
     		{
     		    $sec->update_login_settings($_POST['allow_logins'], $_POST['max_logins'], $_POST['lock_len']);
     		}
    to

    Code:
     	function update_login_settings($allow, $attempts, $lock_time)
     	{
     		// Should't really need to slash as it's list data, but you never know!
     		
     		$allow 		= $this->doslash($allow);
     		$attempts 	= $this->doslash($attempts);
     		$lock_time	= $this->doslash($lock_time);
     
     		$allow 		= (int) $allow;
     		$attempts 	= (int) $attempts;		
     		$lock_time 	= $lock_time * 60;
     		
     		die($lock_time);
     		
     		//Insert the data.
     		//$this->query("UPDATE ".TBL_PREFIX."site_settings 
     		    		//SET allow_logins='$allow', max_login_attempts='$attempts', lock_length='$lock_time'");
     	
     	}
    No matter what I seem to do with the $lock_time variable (int) or otherwise, the value it returns is just blank.

    Am I missing something obvious?

  2. #2
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    where are you returning it. you are using
    die($lock_time);

    i think you meant
    return($lock_time); to return something from a function.

    hope this helps

    EDIT: and if you need to do any inserts then you do it before the return. anything after return just won't execute.
    ---------------------------
    Errors = Improved Programming.
    My Site

  3. #3
    SitePoint Addict
    Join Date
    Apr 2004
    Location
    UK
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jaswinder_rana
    where are you returning it. you are using
    die($lock_time);

    EDIT: and if you need to do any inserts then you do it before the return. anything after return just won't execute.
    Thanks for replying. The die was added only so I could see what the value was before running the SQL update.

    Code:
      		$this->query("UPDATE ".TBL_PREFIX."site_settings 
     		 		SET allow_logins='$allow', max_login_attempts='$attempts', lock_length='$lock_time'");
    It seems fine until I run the multiplication on it and then it just loses its value.


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
  •