Tuesday, 28 August 2018
Subscribe to:
Post Comments (Atom)
<?php
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'user');
define('DB_PASSWORD', 'pass');
define('DB_DATABASE', 'db');
$link = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
$query = "SELECT * FROM group WHERE date_time >= NOW() order by date_time LIMIT 1";
$next = mysqli_query($link, $query);
echo $next;
?>
fetch
function will return null
instead of an array if no rows were matched by the query.$query = "SELECT * FROM `group` WHERE date_time >= NOW() ORDER BY date_time LIMIT 1";
$result = mysqli_query($link, $query);
$row = mysqli_fetch_assoc($result);
if ($row) {
$date_time = $row['date_time'];
echo "Next date is " . $date_time;
} else {
echo "No time after now in the table.";
}
Hello Friends! I am Ramana a part time blogger from Hyderabad.
0 comments:
Post a Comment