Insert into DB

2 posts by 2 authors in: Forums > CMS Builder
Last Post: February 11, 2009   (RSS)

Re: [rwbuentello] Insert into DB

By Dave - February 11, 2009

Hi rwbuentello,

There's no CMS Builder functions for this, but if you're comfortable with PHP and MySQL the basic code looks like this:

$query = "INSERT INTO cms_articles SET title='Hello', content='This is the content' ";
$result = mysql_query($query);
if (!$result) { die("MySQL Error: ". htmlspecialchars(mysql_error()) . "<br/>\n"); }


I've also attached a sample addForm.php file that shows an example of a working form that inserts records and has basic data validation, etc.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com
Attachments:

addform.php 3K