set_time_limit not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • muthumeena
    New Member
    • Mar 2007
    • 6

    set_time_limit not working

    how to set time to live for a script in php?

    i have tried with set_time_limit( );
    my code was

    <?php
    set_time_limit( 20);
    ?>

    this is not working for me... can anybody please help me out in this...
  • vssp
    Contributor
    • Jul 2006
    • 268

    #2
    Originally posted by muthumeena
    how to set time to live for a script in php?

    i have tried with set_time_limit( );
    my code was

    <?php
    set_time_limit( 20);
    ?>

    this is not working for me... can anybody please help me out in this...


    WHILE($list = mysql_fetch_ass oc($result) {
    set_time_limit( 2); // Timelimit 2 seconds for sending each mail
    mail($list[email], $list[Subject], $list[Message]);
    }
    set_time_limit( 5); // Timelimit to finish script

    Comment

    • muthumeena
      New Member
      • Mar 2007
      • 6

      #3
      Suppose after specified seconds, my script has to expire and reload again, what should i do?

      Comment

      • mgast
        New Member
        • Sep 2006
        • 9

        #4
        What exactly are you trying to do? Could you post some code?

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          You are double posting in this forum, see also http://www.thescripts.com/forum/thread618578.html which will be removed. - moderator

          And when you post code, show it within code or php tags, as detailed in the Posting Guidelines at the top of this forum!

          Ronald :cool:

          Comment

          • muthumeena
            New Member
            • Mar 2007
            • 6

            #6
            Originally posted by ronverdonk
            And when you post code, show it within code or php tags, as detailed in the Posting Guidelines at the top of this forum!

            Ronald :cool:
            this is my php code for registering a user with a password.

            <?php

            //replace username and password with your mysql name and password
            $conn = mysql_connect(" localhost","roo t","mobileproje ct") or die("Connection Error");

            //select the database
            $db = mysql_select_db ("test")or die("Connection Error");
            session_start() ;
            $_SESSION['username'] = $_POST['username'];
            echo $_SESSION['username'];
            $password = md5($_POST['password']);
            $email = $_POST["email"];

            //insert the values
            $result= MYSQL_QUERY("IN SERT INTO users (username, password)".
            "VALUES ('{$_SESSION['username']}', '$password')");

            $temp_table=mys ql_query("creat e table {$_SESSION['username']}(name varchar(30) not null,source varchar(30),des tn varchar(30),fli ght varchar(10),sea t int);")or die("creation error");
            $temp_value=mys ql_query("inser t into {$_SESSION['username']}(name,source,d estn,flight,sea t)values('{$_SE SSION['username']}','0','0','0', '0')")or die("Insertion Error");
            echo "Your name and password have been submitted into our database :)";
            echo "<br/>";
            echo "<a href=login.php> Back to Login</a>"
            ?>

            now my objective is to set the time to live for the script. suppose if i am going to set 10 minutes for the script, the script should expire after 10 minutes and have to reload again? what will be solution to this?

            Comment

            • ronverdonk
              Recognized Expert Specialist
              • Jul 2006
              • 4259

              #7
              Why don't you just do as was requested in the previous post?? Enclose your code within code or php tags. Or else read the Posting Guidelines before you show anything here.

              moderator

              Comment

              Working...