const indexes = [2, 0, 1, 1, 1, 2];
/**
*
* @param {number} amount
* @param {string[]} cases For slavic languages: ['яблоко', 'яблока', 'яблок']
* @returns {string}
*/
function pluralize(amount, cases) {
const mod100 = amount % 100;
const mod10 = amount % 10;
const index = (mod100 > 4 && mod100 < 20) ? 2 : indexes[(mod10 < 5) ? mod10 : 5];
return cases[index];
}
var data = data.split("\n").reduce((prev,curr)=>{
prev.push(curr.split(',').map(x=>parseInt(x)))
return prev
}, [])
собственно сделал вот такой шаблон правильно или нет?
<div class="title-page"><h1 class="breadcrumb">Объявления</h1></div>
<li class="header-name"><a href="/" title="">title</a></li>
<li class="clearfix"></li>
<li class="" title=""><a href="" target="_blank">ВК</a></li>
public function start ($message) {
$info=[];
foreach ($user as $user){
$status = $op->post($message,$user,$us);
if($status == false){
$info[] = "error";
}else{
$info[] = "ok";
}
}
return $info;
}
$query = "SELECT * FROM `base` WHERE `name` = 'test' order by `date` DESC LIMIT 10";
if ($result = $mysqli->query($query)) {
while ($row = $result->fetch_assoc()) {
// code
}
}
SELECT l.login,l.password,l.mail,c.name FROM login as l JOIN char as c ON (l.login = c.login) WHERE l.login = 'SomeLogin'
--- тут условие, предположим login.
$pdo = new \PDO('mysql:host=localhost;dbname=db','user','password');
$request = $pdo->prepare('SELECT l.login,l.password,l.mail,c.name FROM login as l JOIN char as c ON (l.login = c.login) WHERE l.login = :login');
$request->execute([':login' => $_POST['login']);
$result = $request->fetch(\PDO::FETCH_ASSOC);