I am using oscommerce so you might need an understanding of it to answer this but I don’t think so it is pretty general.
Why would the original programmers create functions to do basic sql queries like this:
function tep_db_query($query, $link = 'db_link') {
global $$link, $logger;
if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
if (!is_object($logger)) $logger = new logger;
$logger->write($query, 'QUERY');
}
$result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error());
if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
if (mysql_error()) $logger->write(mysql_error(), 'ERROR');
}
return $result;
}
When I seem to be able to accomplish a query using the regular mysql_query?
My guess is so that you don’t have to keep redefining the db connection? I’m not sure though because I can just use mysql_query like I said. Obviously I’m pretty new at this so I’m missing something just curious what.
In this case, to
Without commenting on the actual quality of this code, this is a pretty common practice.