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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MikeB

    #1

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

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

    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, additionalGroup s, memberName, passwordSalt
    FROM {$db_prefix}mem bers
    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
    functions?

    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.
  • Curtis

    #2
    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.c om wrote:
    I once did a course on PHP and I'm now trying to get back into the
    language.
    >
    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, additionalGroup s, memberName, passwordSalt
    FROM {$db_prefix}mem bers
    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
    functions?
    >
    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.
    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:

    PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.


    where function_name_o r_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.
    --
    Curtis
    $email = str_replace('si g.invalid', 'gmail.com', $from);

    Comment

    • =?ISO-8859-1?Q?=22=C1lvaro_G=2E_Vicario=22?=

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

      MikeB escribió:
      $request = db_query("
      SELECT passwd, ID_MEMBER, ID_GROUP, lngfile, is_activated,
      emailAddress, additionalGroup s, memberName, passwordSalt
      FROM {$db_prefix}mem bers
      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
      functions?
      You forgot to search within SMF itself ;-)

      Buscando: function db_query
      Sources\Subs.ph p(238): function db_query($db_st ring, $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
      --

      Comment

      • larry@portcommodore.com

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

        In the code, I see (for instance):
        >
        $request = db_query("
        SELECT passwd, ID_MEMBER, ID_GROUP, lngfile, is_activated,
        emailAddress, additionalGroup s, memberName, passwordSalt
        FROM {$db_prefix}mem bers
        WHERE memberName = '$_REQUEST[user]'
        LIMIT 1", __FILE__, __LINE__);
        >
        I'd say user written or framework. PHP usually includes the DB
        engine name in their database commands.

        Comment

        Working...