<?php
require $_SERVER['DOCUMENT_ROOT'] . '/inc/connect.php';
function CheckDestiny ($variable,$type) {
if ($type == "ONE") {
switch ($variable) {
case $variable > 100000 and $variable < 249999:
echo "QUERY 1";
$add_destiny = mysqli_query($db, "UPDATE `data` SET `column` = '$variable; WHERE `symbol` = '$db_symbol[$t]'");
break;
case $variable > 250000 and $variable < 499999:
echo "QUERY 2";
break;
}
}
}
$search_destiny = mysqli_query($db, "SELECT * FROM `items` ORDER BY `id` LIMIT 0,35");
while ($select_destiny = mysqli_fetch_assoc($search_destiny))
{ $db_ticker[] = $select_destiny['name'];
$db_symbol[] = $select_destiny['sym'];
$db_price[] = $select_destiny['price'];
}
for ($t = 0; $t < count($db_symbol); $t++) {
echo $t . ". - " . $db_symbol[$t] . " == Цена <b>" . $db_price[$t] . "</b> <br>";
// ....... etc
CheckDestiny($sum_usdt,"ONE");
?>
<?php
$driver = "mysql";
$host = "localhost";
$db_name = "j82769333";
$db_user = "j82769333";
$db_pass = "passwd";
$charset = "utf8";
$options = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION];
$db = mysqli_connect($host, $db_name, $db_pass, $db_name);
?>
$db = mysqli_connect($host, $db_name, $db_pass, $db_name);
if (!function_exists('db')) {
function db () { global $db; return $db; }
}
if (!function_exists('db')) {
function db () {
static $db;
if (!$db) $db = mysqli_connect($host, $db_name, $db_pass, $db_name);
return $db;
}
}
$add_destiny = mysqli_query(db(), "UPDATE `data` SET `column` = '$variable; WHERE `symbol` = '$db_symbol[$t]'");
function CheckDestiny ($variable,$type) use ($db) {
// ...
}