<?php require("db.php"); $count = 0; if(isset($_POST['count'])){ $sql = mysqli_query($conn, "SELECT * FROM views"); $data = mysqli_fetch_assoc($sql); $newcount = $data['count']; if(mysqli_num_rows($sql) > 0){ $newcount+=1; $sql = mysqli_query( $conn, "UPDATE views SET count='$newcount'"); if($sql){ echo "Success"; } } }else{ echo "Something went wrong"; die; } // getCount(); }else{ return false; } ?>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter