Skip to Content About Archive Belief Contact Pudding Search


custom db query, and db prep functions


Thursday, September 20, 2007

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

here’s a few functions that are required by some of my code / functions.

make_db_connection

function make_db_connection($conn_name, $conn_sql)
{

global $site_access, $database_site_access;

$covert_this_str = "global \$" . $conn_name . " ;";
eval($covert_this_str);
$covert_this_str = "\$" . $conn_name . "= mysql_query(\$conn_sql,\$site_access ) or die(mysql_error());";//report_error(’002′,’" . addslashes($conn_sql) . "’));";
//echo $conn_sql."<br />";
eval($covert_this_str);
// addKill($conn_name);
}

fixForDB

function fixForDB($item,$nonEmpty=0){

$item=trim($item);
if(empty($item)){

$item=$nonEmpty;

}

if(isNaN($item)){
$item=”‘”.addslashes($item).”‘”;
}

return $item;
}

isNaN
this isn’t a function of mine. I found it on the php.net manual site. if you wrote it, please let me know so i can give proper credit

function isNaN( $var ) {
return !ereg (”^[-]?[0-9]+([\.][0-9]+)?$”, $var);
}

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
Might Be Related

Leave a Reply


In order to submit a comment, you need to mention your name and your email address (which won't be published). And ... don't forget your comment!

Comment Form