function sqlQuery( $sql )
{
if( in_array( 'mysql', $GLOBALS[ 'loaded_extensions' ] ) )
{
$query = mysql_query( $sql ) or die(
"<pre><font color="red"><b>Invalid SQL:</b>
("
. mysql_errno()
. ' ) '
. mysql_error()
. "
"
. "<b>Query:</b>
"
. eregi_replace( " ", ' ', $sql )
. '</font></pre>' );
}
elseif( in_array( 'mysqli', $GLOBALS[ 'loaded_extensions' ] ) )
{
$query = mysqli_query( $GLOBALS[ 'dbHandle' ], $sql ) or die(
"<pre><font color="red"><b>Invalid SQL:</b>
("
. mysqli_errno( $GLOBALS[ 'dbHandle' ] )
. ' ) '
. mysqli_error( $GLOBALS[ 'dbHandle' ] )
. "
"
. "<b>Query:</b>
"
. eregi_replace( " ", ' ', $sql )
. '</font></pre>' );
}
return $query
}
php mysql/mysqli query
Leave a Reply
You must be logged in to post a comment.