Menu

not a valid MySQL-Link resource

2002-10-03
2002-10-04
  • Nobody/Anonymous

    I am experiencing the following error when trying to
    load the index.php:
    Warning: Supplied argument is not a valid MySQL-Link resource in /var/www/phpinv/inc/db_mysql.php on line 56
    Database error in phpInv: Invalid SQL: INSERT INTO phpinv_session (hash, userid, ip, useragent, activity) VALUES
    ('3288f18a333cfb94d8e87a63c25aad80','1','156.127.2.173','Mozilla/4.79 [en] (Windows NT 5.0; U)',now() )
    mysql error:
    mysql error number:
    Date: 03.10.2002 @ 09:40
    Script: /phpinv/category.php?hash=
    Referer: http://156.127.2.140/phpinv/

    This is after I changed db_mysql.php to have "1" as
    the link_id variable. The default was "0" but using that generates an error about failing to connect using passwd YES even though I have the user/pass defined in db_mysql.php

    The database and tables have been created and I can login fine via command line. Any help or suggestions ? Thanks.

     
    • Nobody/Anonymous

      Also if I run that sql query at the command line
      it works just fine.

       
    • Stefan Cyris

      Stefan Cyris - 2002-10-04

      If you change the link_id predefined value to 1 you also have to change the function connect()
      Instead of "if ( 0 == $this->link_id ) {" use "if ( 1 == $this->link_id ) {".

      Actually there's no need to change it :)

       
    • Nobody/Anonymous

      I wouldn't have changed it (and have changed it back now) if it didn't seem to be ignoring the user and password variables. I get this error:

      Warning: Access denied for user: 'phpinv@localhost' (Using password: YES) in /var/www/phpinv/inc/db_mysql.php on line 25

      Warning: MySQL Connection Failed: Access denied for user: 'phpinv@localhost' (Using password: YES) in /var/www/phpinv/inc/db_mysql.php on line 25

      I don't know why it wants to log in as phpinv.
      I guess the next step is to create a phpinv user with no password and see what happens.
      btw- here is how my php_db file is- do you see anything I did blatently wrong here?:
      This is a cool program I'd really like to get it to work on my system (Debian)
      Thanks
      <?
      class DB {

        var $database = "phpinv";

        var $link_id  = 0;
        var $query_id = 0;
        var $record   = array();

        var $errdesc    = "";
        var $errno   = 0;
        var $show_error = 0;
        var $debug = 1;
       
        var $server   = "localhost";
        var $user     = "root";
        var $password = "xxxxxxx";
        var $tableprefix = "phpinv_";

        var $appname  = "phpInv";

              function connect() {
                      if ( 0 == $this->link_id ) {

       
    • Stefan Cyris

      Stefan Cyris - 2002-10-04

      Just don't change anything in db_mysql.php. It's a database layer to make it simple to use other databases.

      The configs are located in admin/config. you have to change username and password for your database in db.php.

       
    • Stefan Cyris

      Stefan Cyris - 2002-10-04

      Hopefully this help you - just post the errors if not ;)

       
    • Nobody/Anonymous

      wow I couldn't feel more stupid.
      I restored the db_mysql.php, changed the correct
      file as you said and whoolah! Thank you very much!

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.