Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2009
    Location
    Texas
    Posts
    209
    Plugin Contributions
    2

    Default FIX - for mysql_real_escape_string(): A link to the server could not be established

    I had several plugins die with my recent upgrade to 1.5.3 with the error message:
    mysql_real_escape_string(): A link to the server could not be established

    This seems to stem from two problems. First you shouldn't be using the mysql functions and instead use the internal database functions:
    http://www.zen-cart.com/wiki/index.p...ers_-_Database

    Secondly mysql isn't used any more, instead using mysqli.

    The fix is simple (Thanks to lat9 in another thread for pointing this out.)
    Instead of mysql_real_escape_string($value) use:
    $db->prepare_input($value)

    To those in charge. Perhaps the above developers/database wiki should be updated to include $db->prepare_input.

    Anthony

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

    Default Re: FIX - for mysql_real_escape_string(): A link to the server could not be establish

    Even better would be to use the BindVars method described on that same wiki page.


    Nevertheless a note about $db->prepare_input has also been added to the page.
    .

    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. The document name you requested (/index.php) could not be found on this server
    By Heather Ghillyer in forum Built-in Shipping and Payment Modules
    Replies: 8
    Last Post: 25 Jul 2013, 08:49 AM
  2. Links use the server host, not the domain for the site
    By Cinlaenae in forum General Questions
    Replies: 6
    Last Post: 19 Nov 2010, 01:43 AM
  3. Replies: 3
    Last Post: 29 Jul 2010, 03:21 PM
  4. Replies: 3
    Last Post: 12 Sep 2009, 05:40 PM
  5. Server Time not right - how to fix?
    By imfsub12 in forum General Questions
    Replies: 2
    Last Post: 5 Aug 2009, 06:04 PM

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