creating a plugin, how to connect to the database
Hey guys! this is my first post on vanilla forums since everythings changed.. Ive been a fan for about 6 years now and I wanted to start a site using the forums.
I'm working on a plugin that would allow me to edit pages - about and contact pages.
I created a database table for these 2 other pages, and I'm trying to edit them within the dashboard. i got the link to show up on the side, wrote all the script out (its varly small) and then when I went to try it, I found out I had to use the database classes..
I've been reading the docs -- http://vanillaforums.org/docs/database and I thought it would be easy to do by simply do the
$database = new Database;
but then its saying the database class isnt found.. I'm trying to call the class on a separate page within the dashboard.. can someone help me out? this is what I wrote out before I realized I needed to use the class..
$doIt = mysql_query("SELECT * FROM 'gdn_ExtraPages' WHERE id = '".mysql_real_escape_string($_POST['whichPage'])."' LIMIT 1") or die(mysql_error());
$gotIt = mysql_fetch_array($doIt);
and $gotIt returns nothing..
If you could tell me what I need to do before that and how to get what I need from the database that would be awesome.. I'm almost thinking I need to create this within a class but not sure.. I'm gonna try that next..