posting data to the db publically...?

15 posts by 4 authors in: Forums > CMS Builder
Last Post: March 31, 2009   (RSS)

Re: [Dave] posting data to the db publically...?

By s2smedia - March 31, 2009

ok thanks... is there a way to do this with the older version.. just curious

Ill download new version now and test it out...thanks!

By Dave - March 31, 2009

For an older version you could try copying the mysqlStrictMode function (search for "function mysqlStrictMode") from the latest /lib/database_functions.php to the older one. And then repeat that for any other missing functions.

Here's the code for it. Just copy it to your /lib/database_functions.php

//
function mysqlStrictMode($strictMode) {
$currentVersion = preg_replace("/[^0-9\.]/", "", mysql_get_server_info());
$isMySql5 = version_compare($currentVersion, '5.0.0', '>=');

# only for Mysql 5
if (!$isMySql5) { return; }

# set MySQL strict mode - http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html
if ($strictMode) {
$query = "SET SESSION sql_mode = 'STRICT_ALL_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER'";
mysql_query($query) or die("MySQL Error: " .mysql_error(). "\n");
}
else {
$query = "SET SESSION sql_mode = 'NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER'";
mysql_query($query) or die("MySQL Error: " .mysql_error(). "\n");
}
}


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

Re: [Dave] posting data to the db publically...?

By s2smedia - March 31, 2009

Perfect!! thank you!

By dwellingproductions - March 31, 2009

Dave,

Just an unrelated word of thanks for posting the user signup form code earlier in this post. That form, along with reading over the assistance you gave here really helped me in setting up this member area that I've been working on for a client. I was pretty hesitant to agree to do this for them, but your assistance, even indirectly, really saved the day for me. :-)

Thanks again!

Jeremy
---------------------------

Dwelling Productions

www.dwellingproductions.com