Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- $servername = "localhost";
- $username = "user";
- $password = "pass";
- $dbname = "db";
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT * FROM dm_posts where post_date > '2017-04-30'";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- echo "<table><tr><th>ID</th><th>Post Title</th></tr>";
- // output data of each row
- while($row = $result->fetch_assoc()) {
- echo "<tr><td>".$row["ID"]."</td><td>".$row["id"]." ".$row["post_title"]."</td></tr>" ;
- $idd = $row["ID"];
- $int= rand(1388534400,1418342400);
- $futuredate = date("Y-m-d H:i:s",$int);
- $query1 = "UPDATE dm_posts SET post_date = '".$futuredate."' where post_date > '2017-04-30' and id = '".$idd."'";
- $result1 = $conn->query($query1);
- }
- echo "</table>";
- } else {
- echo "All IS DONE";
- }
- $conn->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement