Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21
  1. #11
    Join Date
    Jan 2004
    Posts
    66,387
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: How a new page connecting to server and call database?

    It could be that your PHP configuration for include_path is incomplete. Most modern configurations also contain "." as an include-path so that files can be required/included based on them being "relative" to the current working directory.

    I imagine you can google for how to change the xampp php configuration for include_path.
    .

    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.

  2. #12
    Join Date
    Sep 2015
    Location
    Hong Kong
    Posts
    45
    Plugin Contributions
    0

    Default Re: How a new page connecting to server and call database?

    Quote Originally Posted by DrByte View Post
    It could be that your PHP configuration for include_path is incomplete. Most modern configurations also contain "." as an include-path so that files can be required/included based on them being "relative" to the current working directory.

    I imagine you can google for how to change the xampp php configuration for include_path.
    Thanks DrByte,

    I've just found the include_path in the php.ini
    Name:  includepath.JPG
Views: 63
Size:  35.6 KB
    Could you tell me whether it is correct?

    I uploaded the improved code of mc12345678 in define_page_1 to my real website, the footer and sidebox is disappeared (same in test site in xampp). If removing the "require('includes/application_top.php');", the footer and sidebox appear but it cannot access my store zc database.

  3. #13
    Join Date
    Jan 2004
    Posts
    66,387
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: How a new page connecting to server and call database?

    Chances are you need to change yours to add ".;" before the current include_path. Not sure why you're using the "unix" version when you're running on a Windows PC.
    .

    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.

  4. #14
    Join Date
    Jul 2012
    Posts
    16,751
    Plugin Contributions
    17

    Default Re: How a new page connecting to server and call database?

    Quote Originally Posted by jay2015 View Post
    I've just tried removing the code "require('includes/application_top.php')", sidebox and foot appear, but it cannot access to database when I input waybill number!

    logs message:
    PHP Warning: require(testsite01/includes/application_top.php): failed to open stream: No such file or directory in D:\xampp\htdocs\testsite01\try3.php on line 2

    PHP Fatal error: require(): Failed opening required 'testsite01/includes/application_top.php' (include_path='D:\xampp\php\PEAR') in D:\xampp\htdocs\testsite01\try3.php on line 2

    Is there anything I should try?

    Thanks
    Because try3.php is already in testsite01, any reference to that directory in try3.php should be removed. So if it is considered necessary to load application_top.php from that file, which is questionable, then the require should be:
    Code:
    require('includes/application_top.php');
    Last edited by mc12345678; 15 Aug 2016 at 05:35 PM.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #15
    Join Date
    Sep 2015
    Location
    Hong Kong
    Posts
    45
    Plugin Contributions
    0

    Default Re: How a new page connecting to server and call database?

    Quote Originally Posted by DrByte View Post
    Chances are you need to change yours to add ".;" before the current include_path. Not sure why you're using the "unix" version when you're running on a Windows PC.
    Don't know why it shows unix but I do installed pc version Anyway, I uploaded to real website to test but still not success!

  6. #16
    Join Date
    Sep 2015
    Location
    Hong Kong
    Posts
    45
    Plugin Contributions
    0

    Default Re: How a new page connecting to server and call database?

    Quote Originally Posted by mc12345678 View Post
    Because try3.php is already in testsite01, any reference to that directory in try3.php should be removed. So if it is considered necessary to load application_top.php from that file, which is questionable, then the require should be:
    Code:
    require('includes/application_top.php');
    Thanks your reminded! I'm afraid the problem setting of xampp will influence the result, I edited the define_page_1 with your corrected code in my website directly. There is no any other file with that code.

    case1 -- No require('includes/application_top.php');
    When I input the correct waybill number, it will jump to die message "Cannot access database!". All right side sideboxes and footer disappear.
    When I input wrong number, it will show "Waybill number XXX not found!"! Sidebox and footer are not affedted.

    case2 -- require('includes/application_top.php');
    All right side sideboxes and footer disappear. And no input text box for me to input anything.

    I think you are correct. It may not need to require the application_top. But really don't know why it still not work!

  7. #17
    Join Date
    Sep 2015
    Location
    Hong Kong
    Posts
    45
    Plugin Contributions
    0

    Default Re: How a new page connecting to server and call database?

    For case1, the logs message is:
    PHP Warning: mysql_query(): Access denied for user 'vjanardhan'@'localhost' (using password: NO) in /home5/XXX/public_html/includes/languages/schinese/html_includes/define_page_1.php on line 35
    PHP Warning: mysql_query(): A link to the server could not be established in /home5/XXX/public_html/includes/languages/schinese/html_includes/define_page_1.php on line 35


    I don't know why there is user "vjanardhan"! I do not create this user.

  8. #18
    Join Date
    Jul 2012
    Posts
    16,751
    Plugin Contributions
    17

    Default Re: How a new page connecting to server and call database?

    Quote Originally Posted by jay2015 View Post
    For case1, the logs message is:
    PHP Warning: mysql_query(): Access denied for user 'vjanardhan'@'localhost' (using password: NO) in /home5/XXX/public_html/includes/languages/schinese/html_includes/define_page_1.php on line 35
    PHP Warning: mysql_query(): A link to the server could not be established in /home5/XXX/public_html/includes/languages/schinese/html_includes/define_page_1.php on line 35


    I don't know why there is user "vjanardhan"! I do not create this user.
    That would be because the code I rewrote (as stated in the middle of it) was not fully rewritten. Or really it is because mysql_ related functions are being used instead of the mysqli_ functions (again which ZC currently uses, though could be modified to use whatever database type is to be applied through the ZC accessor functions). Sorry to leave a little "homework", but it's important to learn (or try to) how to correct issues with other's code.

    As to the "try3.php" file and it's use of require('testsite01/includes/application_top.php') and the statement above that it doesn't exist, well, the error log posted several posts back suggests(ed) otherwise.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #19
    Join Date
    Sep 2015
    Location
    Hong Kong
    Posts
    45
    Plugin Contributions
    0

    Default Re: How a new page connecting to server and call database?

    Quote Originally Posted by mc12345678 View Post
    That would be because the code I rewrote (as stated in the middle of it) was not fully rewritten. Or really it is because mysql_ related functions are being used instead of the mysqli_ functions (again which ZC currently uses, though could be modified to use whatever database type is to be applied through the ZC accessor functions). Sorry to leave a little "homework", but it's important to learn (or try to) how to correct issues with other's code.

    As to the "try3.php" file and it's use of require('testsite01/includes/application_top.php') and the statement above that it doesn't exist, well, the error log posted several posts back suggests(ed) otherwise.
    Problems solved, thank you very much!!

    I followed your code and revised the lower part code. No need to require the application top and it is able to load the required data.

  10. #20
    Join Date
    Sep 2015
    Location
    Hong Kong
    Posts
    45
    Plugin Contributions
    0

    Default Re: How a new page connecting to server and call database?

    Tried many times, is it possible to change method Post to Get? With method Get, the page will direct to homepage when I click submit!

 

 
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Can't find a way to search by Model in Advanced Search - could somebody help please?
    By Athens Collectibles in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 11 Sep 2011, 12:14 PM
  2. Add to Cart & Checkout Buttons Direct to Blank Page. Help Please!
    By MehYourFace in forum General Questions
    Replies: 2
    Last Post: 17 Mar 2010, 01:24 AM
  3. Replies: 1
    Last Post: 7 Nov 2008, 02:06 PM
  4. please help me add quantity box on products_all page
    By antpez in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 19 Nov 2007, 02:57 AM
  5. Blank page when add to cart and checkout??! HELP PLEASE!
    By titantechs in forum General Questions
    Replies: 2
    Last Post: 31 Oct 2007, 06:01 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