Trium918 Posted May 22, 2008 Share Posted May 22, 2008 What data type should I use to store PHP scripts in the MySQL database. I want it to be exactly like phpfreaks or similar. Link to comment https://forums.phpfreaks.com/topic/106786-storing-php-scripts-in-mysql/ Share on other sites More sharing options...
soycharliente Posted May 22, 2008 Share Posted May 22, 2008 I'd use TEXT/BLOB. It depends on how long the scripts are. Check the storage capacities. VARCHAR is like 255 I think. Link to comment https://forums.phpfreaks.com/topic/106786-storing-php-scripts-in-mysql/#findComment-547403 Share on other sites More sharing options...
rhodesa Posted May 22, 2008 Share Posted May 22, 2008 Any TEXT datatype TINYTEXT - max of 256 characters TEXT - max of 65,536 characters MEDIUMTEXT - max of 16,777,216 characters LONGTEXT - max of 4,294,967,296 characters Link to comment https://forums.phpfreaks.com/topic/106786-storing-php-scripts-in-mysql/#findComment-547405 Share on other sites More sharing options...
Trium918 Posted May 22, 2008 Author Share Posted May 22, 2008 I'd use TEXT/BLOB. It depends on how long the scripts are. Check the storage capacities. VARCHAR is like 255 I think. Is it possible for an user to store malicious scripts inside of the database? If so, how would I protect against it? Link to comment https://forums.phpfreaks.com/topic/106786-storing-php-scripts-in-mysql/#findComment-547407 Share on other sites More sharing options...
soycharliente Posted May 22, 2008 Share Posted May 22, 2008 If you escape the data properly, it's just like storing normal text. I've never tried to render code, but I'm sure you code with a <pre> tag or something similar. Maybe use htmlspecialchars too. Link to comment https://forums.phpfreaks.com/topic/106786-storing-php-scripts-in-mysql/#findComment-547411 Share on other sites More sharing options...
947740 Posted May 22, 2008 Share Posted May 22, 2008 You could put html comments around the php code. Then the html will not read it. Of course, you will have to remove the comments when you want to display the code. Link to comment https://forums.phpfreaks.com/topic/106786-storing-php-scripts-in-mysql/#findComment-547415 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.