db_query is it part of PHP or MySQL or user-written

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I once did a course on PHP and I'm now trying to get back into the

I'm looking at some of the SMF scripts and am getting stuck very early
on in figuring out things.

In the code, I see (for instance):

$request = db_query("
        SELECT passwd, ID_MEMBER, ID_GROUP, lngfile, is_activated,
emailAddress, additionalGroups, memberName, passwordSalt
        FROM members
        WHERE memberName = '$_REQUEST[user]'
        LIMIT 1", __FILE__, __LINE__);

What I can't figure out (after having searched both the php.net site
and the MySQL site if the
db_query is a user-written function or part of the built-in MySQL

I've looked in the code and couldn't find where such a function might
be defined.  If it is not in the actual module I'm looking at, it must
be included with an include or some other method?

I strongly suspect that the db_query function is specific to the SMF
scripts, since it is passing the file name and line number so I
suspect that the db-query function can issue a good diagnostic message
with traceback to the calling code.  But I can't figure out where they
have hidden the function.

Re: db_query is it part of PHP or MySQL or user-written

In article

Quoted text here. Click to load it

db_query is most likely user-written.  It's not a MySQL-specific query
(that call is mysql_query()).  You should pick up the book you used and
read it again.  I haven't touched Perl or php in a couple years and it
fades fast.  The manual pages on


are quite helpful and searchable.

DeeDee, don't press that button!  DeeDee!  NO!  Dee...
[I filter all Goggle Groups posts, so any reply may be automatically by ignored]

Re: db_query is it part of PHP or MySQL or user-written

On Mon, 10 Nov 2008 14:29:28 -0800 (PST), MPBrede@gmail.com wrote:
Quoted text here. Click to load it

You'd probably get more/better answers about SMF when asking in the
SMF community.  As Michael Vilain pointed out, db_query() is not
defined in the MySQL API.  If you want to find where it is defined
within the SMF source code, either search SMF documentation, or
possibly resort to grep'ing on the command line for "function
db_query(" or something to that effect.

A quick PHP manual shortcut to keep in mind: you can easily search
PHP's docs for any function by using:


where function_name_or_feature is whatever you intend to look up.  
The result is, more often than not, what's most relevant, and the
thing for which you're looking.
$email = str_replace('sig.invalid', 'gmail.com', $from);

Re: db_query is it part of PHP or MySQL or user-written

MikeB escribió:
Quoted text here. Click to load it

You forgot to search within SMF itself ;-)

Buscando: function db_query
Sources\Subs.php(238): function db_query($db_string, $file, $line)
1 caso(s) encontrado(s) en 1 archivo(s)

-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com

Re: db_query is it part of PHP or MySQL or user-written

Quoted text here. Click to load it

I'd say user written or framework.   PHP usually includes the DB
engine name in their database commands.

Site Timeline