SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do I only need it after the script showed a list of results? Is it necessary to use it after a form submittion?

    I have a script like:

    if ($id)
    {
    //update data
    $sql = "UPDATE blah...";
    }

    else
    {
    //add data
    $sql = "INSERT blah...";
    }

    $result = mysql_query($sql);
    echo "<p>Record updated/edited!</p>";


    But when I put mysql_free_result ($result) at the end of that, it complains that "Supplied argument is not a valid MySQL result resource"

    Is it because I don't need it? Or did I just put that flush memory thing in the wrong place?


  2. #2
    SitePoint Addict Chris Roane's Avatar
    Join Date
    Jul 1999
    Location
    Helena, MT
    Posts
    287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Well, I have never used that function before and I have been messing with MySQL and PHP a lot the last few months, so I am assuming you don't really need it, but I could be wrong. I know for sure I haven't had any problems from not using it.

    Just letting you know from my experience.

    Chris Roane

  3. #3
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unless you do a lot queries (or queries take a lot of memory), you don't really need to free memory from mysql_query
    And the syntax is correct though! I don't see why it complained. Could it be MySQL version? I am not sure.
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •