functie cu rezultat din setari
Last Updated: Oct 23 2021 19:32, Started by
bunicu9
, Oct 23 2021 19:32
·
0
#1
Posted 23 October 2021 - 19:32
Am acest tabel
CREATE TABLE `system_options` ( `option_id` int(10) UNSIGNED NOT NULL, `option_name` varchar(128) NOT NULL, `option_value` varchar(2048) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; INSERT INTO `system_options` (`option_id`, `option_name`, `option_value`) VALUES (1, 'system_admin_email', '[email protected]'), (2, 'system_limit', '2'); Iar in functions.php am pus aceasta cod $get_system_options = $conn->query("SELECT * FROM system_options"); while($system_option = $get_system_options->fetch()) { $system[$system_option['option_name']] = $system_option['option_value']; }Acum in orice php in care includ functions.php pot obtine valoarea unei setari echo $system['system_limit'];si obtin valoarea 2 problema e ca nu pot sa obtin valoarea unei stari in functiile din functions.php function test($name) { global $conn; // prepare sql and bind parameters try{ $stmt = $conn->prepare("SELECT * FROM users WHERE name=:name"); $stmt->bindParam(':name', $name); $stmt->execute(); $result = $stmt->fetch(PDO::FETCH_ASSOC); }catch(PDOException $exception){ //test } if ($result < $system[''system_limit]) { error_log('Limit < 2'); } Ce as putea face? Edited by bunicu9, 23 October 2021 - 19:35. |
Anunturi
Bun venit pe Forumul Softpedia!
▶ 0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users