#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 1999
    Location
    Canada, Toronto
    Posts
    103
    Rep Power
    15
    platform: Win32
    php version: 4.0 binaries
    code:

    1: mysql_connect($db_Hostname, $db_Username, $db_Password);
    2: mysql_select_db($db);
    3: $result = mysql_query("DELETE FROM test WHERE DATE_FORMAT(itime,'Ymd')='20000609'");
    4: $nr = mysql_affected_rows($result);

    result:
    Warning: Supplied argument is not a valid MySQL-Link resource in test.php3 on line 4


    any ideas?? the query executed just fine, but i cant get the affected rows value... work perfect in php3


    ------------------
    Alex D. G.
    http://www.alexdg.com



    [This message has been edited by AlexDG (edited June 09, 2000).]
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    4
    Rep Power
    0
    Well, dude!

    The answer is cleverly hidden under your nose.

    "Supplied argument is not a valid MySQL-Link ..."

    Notice "Link" - NOT RESULT.

    Try something like this:


    $link=mysql_connect(localhost, user, pass);

    mysql_select_db(test);

    #$query="delete from stuff where <blah>";

    $result = mysql_query($query);

    echo mysql_affected_rows($link);

    I think you'll be much happier with the results! =)
  4. #3
  5. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    18
    Yep.

    mysql_affected_rows() uses the link identifier, NOT a result identifier, as the argument.

  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 1999
    Location
    Canada, Toronto
    Posts
    103
    Rep Power
    15
    it doesn't get more embarrassing than this =)

    thnx guys



    ------------------
    Alex D. G.
    http://www.alexdg.com

Similar Threads

  1. Replies: 2
    Last Post: August 18th, 2004, 10:45 PM
  2. How to see the Memory used by a PHP script?
    By Pardall in forum PHP Development
    Replies: 4
    Last Post: February 13th, 2004, 03:54 PM
  3. PHP with UnixODBC
    By coder4hire in forum PHP Development
    Replies: 2
    Last Post: January 20th, 2004, 01:14 PM
  4. Passing string from PHP to Javascript
    By ka8oad in forum JavaScript Development
    Replies: 4
    Last Post: January 17th, 2004, 03:12 PM
  5. UnixODBC + PHP + Apache + Empress
    By coder4hire in forum Database Management
    Replies: 0
    Last Post: January 15th, 2004, 01:41 PM

IMN logo majestic logo threadwatch logo seochat tools logo