Best way to store data in root SQL database using livephp
Hi,
Developing a plugin for cPanel that will need to store data for a user when they fill in a form on the plugin. I need this to be stored in a database table in the root SQL DB as the user can't go change things from outside of the plugin form page.
Does anyone have a recommended way of doing this? If so any doc links or example code would be great!
Thanks,
-
Hello :) Could you elaborate a little more on the nature of the plugin? For instance, are you integrating any cPanel functions? Thank you. 0 -
When you install the plugin (you need to build your own installer), you can create a database as root and then you can access it through PHP's mysqli functions ([url=http://php.net/manual/en/book.mysqli.php]PHP: Mysqli - Manual). However, if you just need to store data for an individual user, using MySQL is probably not the way to go. You should use cPanel's NVData (non-volatile data store) functions to store individual user data: [url=http://docs.cpanel.net/twiki/bin/view/ApiDocs/Api2/ApiNVData]NVData Module Documentation The main advantage of NVData over MySQL is that the data will be stored in the user's $HOME directory which means if their account is transferred to a different cPanel server, the data will still be available. 0
Please sign in to leave a comment.
Comments
2 comments