Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 2004
    Posts
    246
    Plugin Contributions
    0

    Default Custom Stock update script refusing to work

    Hi

    My customer has a shoe store. I took over the hosting of this site about a year ago and have found that the previous web designer had a stock update script that could be run via cron. I've adjusted the database settings but I keep getting connection errors.

    Here is the code

    <?php

    require'db_connect.php';

    $arrLines = file('http://www.pleaserusa.com/download/Inv_stat.csv');
    $arrLines = array_slice($arrLines, 1);
    foreach ($arrLines as $line)
    {
    list($productCode, $size, $inStock) = explode(',',$line);
    updateInsert($productCode, $size, $inStock);
    }

    function updateInsert($productCode, $size, $inStock)
    {
    if($inStock == '"YES"' || $inStock == '"LOW"')
    {
    $inStock = 1;
    }
    else
    {
    $inStock = 0;
    }
    $size = str_replace('"','', $size);


    $sql_in = "REPLACE INTO tblPleaserStock (strProductCode, strSize, bolInStock) VALUES ($productCode, '$size', $inStock)";
    mysql_query($sql_in) or die ("Error Inserting with query ".$sql_in);

    $sql_up = "UPDATE tblPleaserStock SET bolInStock = $inStock WHERE strProductCode = $productCode AND strSize = '$size'";
    mysql_query($sql_up) or die ("Error Updating with query ".$sql_up);
    }

    ?>

    and the error is

    Warning: mysql_query() [function.mysql-query]: Access denied for user 'lingerie'@'localhost' (using password: NO) in /home/lingerie/public_html/scripts/update_stock.php on line 29

    Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/lingerie/public_html/scripts/update_stock.php on line 29
    Error Inserting with query REPLACE INTO tblPleaserStock (strProductCode, strSize, bolInStock) VALUES ("AC103/B", '1', 1)

    The database user is actually lingerie_zen and a password is set. The website is running on a standard cpanel server.
    Any advice or help to get this script working correctly would be great.

    Thanks
    UK based Zen Cart Web Designer here www.handcoded.co.uk

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Stock update script refusing to work

    What is in your "db_connect.php" file??
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Jul 2004
    Posts
    246
    Plugin Contributions
    0

    Default Re: Stock update script refusing to work

    <?php
    define('host', 'localhost');
    define('username', 'lingerie_zen');
    define('password', '******');
    define('dbname', 'lingerie_zen');
    ?>
    UK based Zen Cart Web Designer here www.handcoded.co.uk

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Stock update script refusing to work

    I would compare these settings to those in the cart configure.php file
    Zen-Venom Get Bitten

  5. #5
    Join Date
    Jul 2004
    Posts
    246
    Plugin Contributions
    0

    Default Re: Stock update script refusing to work

    I took these settings from the Zen Cart configure file.
    UK based Zen Cart Web Designer here www.handcoded.co.uk

  6. #6
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Stock update script refusing to work

    Does that user have "all privileges" allowed?
    Zen-Venom Get Bitten

  7. #7
    Join Date
    Jul 2004
    Posts
    246
    Plugin Contributions
    0

    Default Re: Stock update script refusing to work

    Yes they do. I set up a new user just for this purpose.
    UK based Zen Cart Web Designer here www.handcoded.co.uk

  8. #8
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Stock update script refusing to work

    Warning: mysql_query() [function.mysql-query]: Access denied for user 'lingerie'@'localhost' (using password: NO)
    There is a reason that access is denied
    Zen-Venom Get Bitten

  9. #9
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Custom Stock update script refusing to work

    Quote Originally Posted by longstockings View Post
    Warning: mysql_query() [function.mysql-query]: Access denied for user 'lingerie'@'localhost' (using password: NO) in /home/lingerie/public_html/scripts/update_stock.php on line 29
    Um, "(using password: NO)" means your custom script isn't passing a password.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Inventory update script
    By clint6998 in forum General Questions
    Replies: 7
    Last Post: 31 Mar 2016, 10:17 PM
  2. IE6 update warning script?
    By celticwebsolutions in forum General Questions
    Replies: 0
    Last Post: 25 May 2010, 01:45 AM
  3. custom image popup script only work for main image, not for additional images
    By gems14k in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 4 Oct 2006, 05:19 AM
  4. SQL Update Script Help
    By jayson.gurney in forum Customization from the Admin
    Replies: 5
    Last Post: 20 May 2006, 10:00 AM

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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR