title: How do I delete rows of data from mysql table automatically with 24 hours after data into table?
body: <p>For example, i have a data input program And I want to delete my data automatically after 1 day of this data I input. how I do that?<br />
  Someone can explain in code?</p>
  <p>Create.php these values are sent to the server</p>
  <pre><code>&lt;form action=&quot;&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;
      &lt;input type=&quot;text&quot; name=&quot;name_portofolio&quot;&gt;
      &lt;textarea name=&quot;info_portofolio&quot;&gt;&lt;/textarea&gt;
      &lt;input type=&quot;file&quot; accept=&quot;image/*&quot;  name=&quot;picture_portofolio&quot;&gt; 
      &lt;button type=&quot;submit&quot; name=&quot;submit&quot;&gt;Save&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  <p>function-add.php</p>
  <pre><code>&lt;?php
  
  function create_data($name_portofolio, $info_portofolio,
                    $picture_portofolio)
  {
     global $connect;
     $name_portofolio = mysqli_real_escape_string($connect, $name_portofolio);
     $info_portofolio = mysqli_real_escape_string($connect, $info_portofolio);
  
  
     $filePath = &quot;picture/&quot;.basename($picture_portofolio[&quot;name&quot;]);
     move_uploaded_file($picture_portofolio[&quot;tmp_name&quot;], $filePath);
  
     $query = &quot;INSERT INTO portofolio 
           (name_portofolio, info_portofolio, picture_portofolio) 
            VALUES ('$name_portofolio', '$info_portofolio', '$filePath')&quot;;
  
     if(mysqli_query($connect, $query))
     {
        return true;
     }else{
        return false;
     }
    } // create_data
  </code></pre>
  <p>db.php</p>
  <pre><code>&lt;?php
  $host = &quot;127.0.0.1&quot;;
  $user = &quot;root&quot;;
  $password = &quot;&quot;;
  $db = &quot;wherco&quot;;
  
  // create connection
  $connect = new mysqli($host, $user, $password, $db);
  
  // check connection
  if($connect-&gt;connect_error) {
      die(&quot;connection failed : &quot; . $connect-&gt;connect_error);
  } else {
      // echo &quot;Successfully Connected&quot;;
  }
  
  ?&gt;
  </code></pre>
  <p>thanks .</p>