Below is some example code of how I run my mysql queries, I run them through a function which I think would maybe simpliy switching databases.
Below is an example of a mysql query I run and below that is the actual function.
Would it be difficult to change to a different database type like oracle or some other if I ever decided to using this setup?
Would be able to just modify the function or would I need to change the queries that are on every page?
$sql_photo = "select * from friend_user_photo where userid='$user_id' and defaultphoto='yes' order by auto_id desc";
$result_photo = executeQuery($sql_photo);
function executeQuery($sql) {
$result = mysql_query_2($sql);
if(mysql_error()){
$error = '<BR><center><font size="+1" face="arial" color="red">An Internal Error has Occured.<BR> The error has been recorded for review</font></center><br>';
// If admin is viewing then we show the query code and the error returned
if($_SESSION['auto_id'] == 1){
$sql_formatted = highlight_string( stripslashes( $sql ), true );
$error .= '<b>The MySQL Syntax Used</b><br>' . $sql_formatted . '<br><br><b>The MySQL Error Returned</b><br>' . mysql_error() ;
}
die($error);
}
return $result;
}