Jump to content

SUBIECTE NOI
« 1 / 5 »
RSS
Probleme drum servitute

Se pot monta placi de gresie de 1...

Card de debit virtual emis de India

Diferenta ATS generator si PV
 La multi ani @Lotusisrael!

Declarație primar

Contestare amenda politia locala

PC se restarteaza cu erori ecran ...
 Mercedes atego 815 oprire motor

Ce contine Creion rani dupa ras?

Filtru sedimente inainte de pompa?

Paște fericit!
 electrician constructor video curs

Cum pot bloca transferul de date ...

Ce reprezinta in chimie abrevieri...

Google pay ma taxeaza in timp ce ...
 

functie cu rezultat din setari

- - - - -
  • Please log in to reply
No replies to this topic

#1
bunicu9

bunicu9

    Member

  • Grup: Members
  • Posts: 253
  • Înscris: 14.07.2013
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

Forumul Softpedia foloseste "cookies" pentru a imbunatati experienta utilizatorilor Accept
Pentru detalii si optiuni legate de cookies si datele personale, consultati Politica de utilizare cookies si Politica de confidentialitate