Revision: 1218
Updated Code
at September 26, 2006 07:33 by gdonald
Updated Code
function sqlQuery( $sql )
{
if( in_array( 'mysql', $GLOBALS[ 'loaded_extensions' ] ) )
{
$query = mysql_query( $sql ) or die(
"<pre><font color=\"red\"><b>Invalid SQL:</b>\n\n("
. mysql_errno()
. ' ) '
. mysql_error()
. "\n\n"
. "<b>Query:</b>\n"
. eregi_replace( "\t", ' ', $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>\n\n("
. mysqli_errno( $GLOBALS[ 'dbHandle' ] )
. ' ) '
. mysqli_error( $GLOBALS[ 'dbHandle' ] )
. "\n\n"
. "<b>Query:</b>\n"
. eregi_replace( "\t", ' ', $sql )
. '</font></pre>' );
}
return $query
}
Revision: 1217
Updated Code
at September 26, 2006 07:30 by gdonald
Updated Code
function sqlQuery( $sql )
{
if( in_array( 'mysql', $GLOBALS[ 'loaded_extensions' ] ) )
{
$query = mysql_query( $sql ) or die(
"<pre><font color=\"red\"><b>Invalid SQL:</b>\n\n("
. mysql_errno()
. ' ) '
. mysql_error()
. "\n\n"
. "<b>Query:</b>\n"
. eregi_replace( "\t", ' ', $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>\n\n("
. mysqli_errno( $GLOBALS[ 'dbHandle' ] )
. ' ) '
. mysqli_error( $GLOBALS[ 'dbHandle' ] )
. "\n\n"
. "<b>Query:</b>\n"
. eregi_replace( "\t", ' ', $sql )
. '</font></pre>' );
}
Revision: 1216
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 26, 2006 07:27 by gdonald
Initial Code
function sqlQuery( $sql )
{
if( $GLOBALS[ 'SITE_DEBUG' ] && $GLOBALS[ 'LOG_DB_QUERIES' ] )
{
logSQL( $sql );
}
if( in_array( 'mysql', $GLOBALS[ 'loaded_extensions' ] ) )
{
$query = mysql_query( $sql ) or die(
"<pre><font color=\"red\"><b>Invalid SQL:</b>\n\n("
. mysql_errno()
. ' ) '
. mysql_error()
. "\n\n"
. "<b>Query:</b>\n"
. eregi_replace( "\t", ' ', $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>\n\n("
. mysqli_errno( $GLOBALS[ 'dbHandle' ] )
. ' ) '
. mysqli_error( $GLOBALS[ 'dbHandle' ] )
. "\n\n"
. "<b>Query:</b>\n"
. eregi_replace( "\t", ' ', $sql )
. '</font></pre>' );
}
Initial URL
Initial Description
Initial Title
php mysql/mysqli query
Initial Tags
mysql, query
Initial Language
PHP