i am trying to store php code in a mysql table and i am using html and the <?php tags. When i make the insertion the result is to store only the text and html entities without the php tags. i.e.
i want to store the following string
before inserting the string in the database i us htmlentities($dynamicText, ENT_QUOTES, 'UTF-8')
" this is simple text and the text <?php echo $dynamicText ; ?> is dynamic <br />"
and the string stored in the database is
" this is simple text and the text is dynamic <br />"
do you know what seems to be the problem?
My table engine is innodb , encoding utf8 and row format compact if this helps
store php code in a mysql database
Moderator: General Moderators
- akuji36
- Forum Contributor
- Posts: 190
- Joined: Tue Oct 14, 2008 9:53 am
- Location: Hartford, Connecticut
Re: store php code in a mysql database
When you say store do you mean insert as to use the mysql insert
function??
Php can communicate with mysql and insert info into your database,
BUT it is vital that the info you recieve is valid. If info is not
valid a user can insert bad data which leaves you open to
mysql injection (which can destroy your data). It is best to
validate you data using php validation (regular expressions).
Follow this link from Jeff Way's Diving into php
http://blog.themeforest.net/screencasts ... php-day-7/
(php regular expressions)
and
this video tutorial for mysql
(phpmyadmin--handles mysql)
http://www.youtube.com/watch?v=IEJB7DkP7A8
thanks
Rod
function??
Php can communicate with mysql and insert info into your database,
BUT it is vital that the info you recieve is valid. If info is not
valid a user can insert bad data which leaves you open to
mysql injection (which can destroy your data). It is best to
validate you data using php validation (regular expressions).
Follow this link from Jeff Way's Diving into php
http://blog.themeforest.net/screencasts ... php-day-7/
(php regular expressions)
and
this video tutorial for mysql
(phpmyadmin--handles mysql)
http://www.youtube.com/watch?v=IEJB7DkP7A8
thanks
Rod