Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Jan 2003
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Access denied for user: 'ODBC@localhost' (Using password: NO)

    im having a problem DELETING rows from one of my tables in PHP.

    i make various calls to mysql_query, and the script works fine until i add the following line

    PHP Code:
    mysql_query("DELETE FROM {$GLOBALS['TABLES_SEARCH_Page']}"); 
    i have given the user DELETE privilidges, but despite this, i am always returned the error:

    Warning: mysql_query() [function.mysql-query]: Access denied for user: 'ODBC@localhost' (Using password: NO) in g:\www\Resources\php\Search.php on line 142

    any ideas?
    <?XML version="1.0" standalone="Yes" encoding="utf-8"?>
    <SIGNITURE>
    XML is the future - embrace it
    </SIGNITURE>

  • #2
    New Coder
    Join Date
    Jan 2003
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, so this gets more annoying
    if i do this:

    PHP Code:
    $query "DELETE FROM CMS_SEARCH_Page";
    echo 
    $query;
    mysql_query($query); 
    now, not only am i specifying the exact tablename, it fails, but if i copy the echo'd query directly into a mysql command prompt it works, even when logged in under the same credentials
    <?XML version="1.0" standalone="Yes" encoding="utf-8"?>
    <SIGNITURE>
    XML is the future - embrace it
    </SIGNITURE>

  • #3
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't think the problem is the sql query. Maybe look at the connectionstrings or try:
    $result = mysql_query($query, your connection handler)


    (edit=adding the bracket i forgot)
    Last edited by raf; 06-08-2003 at 09:43 PM.

  • #4
    New Coder
    Join Date
    Jan 2003
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts
    this line is line 142. on line 138 is a select query which succedes, and i am using a persistant connection.

    commenting out these 3 delete lines makes the script succede
    <?XML version="1.0" standalone="Yes" encoding="utf-8"?>
    <SIGNITURE>
    XML is the future - embrace it
    </SIGNITURE>

  • #5
    New Coder
    Join Date
    Jan 2003
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OMG thank you so much.

    I never thought it was a problem before, but adding the $db handler to the query makes it suceed !!

    THANKS, ive been staring at this for over 3 hours
    <?XML version="1.0" standalone="Yes" encoding="utf-8"?>
    <SIGNITURE>
    XML is the future - embrace it
    </SIGNITURE>

  • #6
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Your welcome.
    (so following standards and guidelines does pay off)
    Glad you got it working.

  • #7
    New Coder
    Join Date
    Jan 2003
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i had been a bit lax about it recently cos i had been doing it religiously, then i started forgetting and seing it made no difference i started just ignoring it. annoying that that was all it was, id literally been staring at that one for hours
    <?XML version="1.0" standalone="Yes" encoding="utf-8"?>
    <SIGNITURE>
    XML is the future - embrace it
    </SIGNITURE>

  • #8
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It's intriging though.

    I suppose that if you omit it, the active connection is used. If this fails, php will try to open another connection. Since you say you've got a select somewhat sooner in your script, i suspect there is no longer a usefull connection and if this user is only allowed one simultanious connection, MySQL will refuse to open a new one. Just a wild gess

  • #9
    New Coder
    Join Date
    Jan 2003
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i think you're forgetting one thing tho, im using persistant connections, and merely 4 lines previously, the 3lines between are blank/comments, there is a SELECT which works. It is only the DELETE line that failed
    <?XML version="1.0" standalone="Yes" encoding="utf-8"?>
    <SIGNITURE>
    XML is the future - embrace it
    </SIGNITURE>


  •  

    Posting Permissions

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