MySQL / PHP - Storing parameters in a database table: Good or bad idea? -
MySQL / PHP - Storing parameters in a database table: Good or bad idea? -
so far store relevant parameters need website variables in php file; point file through require
statement in each page needs parameters. of times , easy mantain, need alter variables "on fly" , sense need of sort of web-panel can alter them more (i'm thinking web page form update parameters). i've created table in mysql database store parameters (basically, table has 2 columns: paramname
, paramvalue
; i've stored parameter names varchar without $ sign @ beginning), in order create web-panel i've in mind.
i thinking extract parameters names , values using query:
$query=$mysqli->query('select * parameters'); while($row=mysqli_fetch_assoc($query)) { $paramname=$row["paramname"]; $$paramname=$row["paramvalue"]; }
is or bad idea? what main issues encounter doing (in terms of security, too)? how deprecable , unsafe utilize of $$paramname
? i'd improve alter mind or can proceed way? edit: changed mysql_
syntax mysqli_
suggested.
using arbitrary values in database variable references highly risky. you'd want fetch info key/value store self-contained associative array , utilize instead.
you not want using mysql_query
these days. please, set thing away.
php mysql
Comments
Post a Comment