JustPaste.it

asrinc

<?php
date_default_timezone_set('Europe/Istanbul');


$host = "host";
$user = "username";
$pass = "";
$db = "databaseisim";
$baglan = mysqli_connect($host,$user,$pass,$db);
if ($baglan->connect_errno>0){
echo "bağlantı hatası";
}else{
echo "Başarılı <br>";
}
$sql = "SELECT * FROM databaseisim";
$result = $baglan->query($sql);
if($result->num_rows>0){
while($row = $result->fetch_assoc()){

$kayit = $row['kayit'];
}
}
$son2 = substr($kayit, -2);
$tarih = date("d/m/Y");
$tarihson2 = substr($tarih, -2);
$sure = $tarihson2-$son2;
if(($tarihson2 - $son2) == 1){
echo "Kayit Olalı: ". $sure. "Gün oldu";
} elseif (($tarihson2 - $son2) == 2 || $son2 == 7){
echo "Kayit Olalı: ". $sure. "Gün oldu";
}

?>