How to add contents of file to MySQL query inside php -


i'm using following php query install tables in cms system:

$q=new mysql(" insert `adm` (`id`, `login`, `adm`, `passwd`, `czas`, `logged`, `ip`, `email`) values (0, 'admin', 1, password('admin'), 0, 0, '0.0.0.0', 'admin@domain.com'); "); 

however instead of e-mail admin@domain.com use e-mail stored inside /settings/contact.inc.php file is:

    <?php     $emailaddress='admin@domain.com';     ?> 

you can use like,

$query = "insert `adm` (`id`, `login`, `adm`, `passwd`, `czas`, `logged`, `ip`, `email`)            values (0, 'admin', 1, password('admin'), 0, 0, '0.0.0.0', '$emailaddress')"; 

note: need include /settings/contact.inc.php file.

do read: sql injection attacks! learn prepared statements instead, , use pdo or mysqli - this article decide which.


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -