Announcement

Collapse
No announcement yet.

query() vs query_first()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • query() vs query_first()

    can anyone make clear this for me?
    what's difference between query() & query_first() functions in vb3?

    thank.

  • #2
    nvm. i think i got it.
    instead of writing:
    $db = $DB_site->query(blah blah);
    $result = $DB_site->fetch_array($db);
    with query_first(), just simply call $result as:
    $result = $DB_site->query_first(blah blah);

    Comment


    • #3
      query merely executes the query and handles an error if there is one.
      query_first executes the query and returns the first result.

      Comment


      • #4
        Originally posted by xmitchx
        query merely executes the query and handles an error if there is one.
        query_first executes the query and returns the first result.
        yea.. it also creates the array as well..
        query_first is basically killing two birds with one stone..

        1) mysql_query
        2) mysql_fetch_array

        query_first is useful if you wish to get just a row count, etc..
        Last edited by sebe; Wed 2 Mar '05, 10:36pm.

        Comment


        • #5
          There is a link in my sig that describes in detail what db_mysql.php dose.

          query_first also calls a memory saving function that frees the query result after building the array

          Comment


          • #6
            I always call mysql_free_result (or with vB free_result()) after I am done with a query.. its habit

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...
            X