Answer the question
In order to leave comments, you need to log in
How to find a range of dates from the database and display only duplicates?
Hello. There is such a code.
$nnomer = $_POST['nnomer'];
const SQL_GET_MENU_ITEM = '
SELECT datestart, dateend FROM main WHERE namenomer = :namenomer
';
try{
$pdo = new PDO("mysql:host=127.0.0.1;dbname=module;charset=utf8","root","");
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $pdo->prepare(SQL_GET_MENU_ITEM);
$res = $stmt->execute([':namenomer' => $nnomer]);
$row = json_encode($stmt->fetchAll(PDO::FETCH_OBJ));
echo "$row";
}catch(PDOException $e ){
exit( $e->getMessage());
}
[{"datestart":"2016-11-29","dateend":"2016-12-03"},{"datestart":"2016-12-01","dateend":"2016-12-05"}]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question