$sql = "
SELECT users.name, user_dolg.date , predprijatie.pred,doljnosti.dol, DATE_FORMAT( `date`, "d%.m%.Y%") AS `date`
FROM users
INNER JOIN user_dolg ON user_dolg.user_id = users.id
INNER JOIN predprijatie ON user_dolg.dolg_id = predprijatie.id
INNER JOIN doljnosti ON users.doljnost = doljnosti.id
WHERE `date` BETWEEN '2018-12-04' AND '2018-12-31'
ORDER BY `date` ASC";
$sql = "
SELECT users.name, user_dolg.date , predprijatie.pred,doljnosti.dol, DATE_FORMAT( `users`.`date`, "d%.m%.Y%") AS `date`
FROM users
INNER JOIN user_dolg ON user_dolg.user_id = users.id
INNER JOIN predprijatie ON user_dolg.dolg_id = predprijatie.id
INNER JOIN doljnosti ON users.doljnost = doljnosti.id
WHERE `users`.`date` BETWEEN '2018-12-04' AND '2018-12-31'
ORDER BY `date` ASC";
{
if( num <= 1 )
return false;
...
let sqrt = Math.sqrt(num);
for (var i = 2; i <= sqrt;) {
...
return true;
}
SELECT user.name_user, district.name_district
FROM link
LEFT JOIN user ON user.id_user = link.id_user
LEFT JOIN district ON district.id_district = link.id_district
WHERE 1
SELECT user.name_user, district.name_district
FROM user
LEFT JOIN link ON link.id_user = user.id_user
LEFT JOIN district ON district.id_district = link.id_district
WHERE 1
UPDATE link SET id_user = 1, id_district = 1 WHERE id_user = 1
#где 1 - id нужного пользователя
function select(){
global $pdo, $numing, $pagin;
return $pdo->query("SELECT * FROM test ORDER BY name LIMIT $numing,$pagin");
}
$fetch = select()->fetchAll();
function select( $query )
{
global $pdo;
return $pdo -> prepare( $query ) -> execute() -> fetchAll();
}
global $pdo, $numing, $pagin;
$fetch = select( "SELECT * FROM test ORDER BY name LIMIT $numing,$pagin" );