Hello, I'm hoping someone can give me some options to my issue. I have a mysql DB that is setup at the office on a server. The main domain webserver is being hosted off site but does not have mysql support. I would like to pull information off the DB from the office and display it on a web page on the webserver. I am able to connect to the mysql DB from the main page of our website and retrieve data. But when I try to set the template file in my PHP code back to the website, it tells my that it's unable to find the page. Here's a sample of what I'm trying to do.

Main HTML Page resides on a off site hosting company.
Main mysql DB resides on the server at the office. This is accessible through the web with proper security stuff.
From the main page of our website, I POST some info to a PHP program that resides on the DB server at the office. I'm able to select... etc to the DB at the office ... no problems. In this PHP program that resides in the office, I'm using a template to post the information back on to another webpage that resides on the off site web hosting company. I'm having difficulties is doing so. The code I'm using in the PHP file is:

?php
include('phplib/php/template.inc');
$template = new Template('.', 'keep');
$template->set_file('main', "http:\www.mywebsite.com\PQRequest-selectmat.html");
$template->set_block('main', 'select_material', 'select_material_list');

.
.
.
?>

When I run this PHP program, it tells me that it's unable to find the .../PQRequest-selectmat.html file.

Is there a solution here? .. other than paying for mysql support from the web hosting company. I'm hoping I am clear enough in the description of my problem.

Thank you for your help in advance.

    1. You're using the wrong slashes. Web addresses use forward slashes, e.g. http://mysite.com/page.php

    2. If that still doesn't work, the function might not be able to retrieve the remote file (for whatever reason). Try downloading the file to the local server first if this is the case.

      Thanks for your reply. I've made the change from '\' to '/' and still no go. Come to think of it, in desperation, I did try '/' before.

      I know it will work if I download the html file to the local machine. But I'm trying to avoid this as there are many links, objects, pics, ... etc that makes up this html page. I will have to download almost the entire site to the local machine in order for this html page to look proper. I'm also trying to keep all HTML code on the hosting site and the DB stuff at the office. Also, I'm trying to avoid replication of files (ic pics, buttons, ... etc.)

      Any other suggestions would be greatly appreciated.

        Well ... here's a solution I guess. It seems to work.

        Rather than having the template code in the PHP program on the DB server in the office, I invoked a PHP program useing HEADER() that resides on the web server. This new PHP program is set up as a GET so that I can pass the info I got from the DB through the PHP program that resides on the DB server via the URL (ie. www.mywebsite.com?STUFF=all%20the%20stuff%20I%20want%20to%20pass). Now that I've passed the info over to the web server, I can now use the template method to display the info from the DB on to the HTML page that also resides on the web server 😃

        Couple of things to remember is when you're passing blanks from the DB php programs to the web server PHP program, make sure to replace it with %20 or else it will stop at the first blank it finds. I used str_replace(). Once the info is over to the PHP program in the web server, any quotes (') are changed to "back slash + quote" (\'). You will need to get rid of the back slash. Again str_replace() works quite well.

        Hope this helps someone... someday.

        cheers.

          kartracer wrote:

          You will need to get rid of the back slash. Again str_replace() works quite well.

          Or turn off magic_quotes_gpc (which should be done on any and all servers you use).

          If that's not the case, there's always [man]stripslashes/man to do the job anyway.

            Write a Reply...