Page 1 of 1

How to include php script

Posted: Tue Aug 22, 2006 1:42 am
by Essie
Hi,
I have a guestbook script that I would like to include it's entry into my cms pages.  I set up the user defined tag as {guestbook}.  In it, I wrote something like:

Code: Select all

include("/path/to/public_html/guestbook/stats.php");

@include('/path/to/public_html/guestbook/inc/database.inc.php');
Then in the template page, I inserted the {guestbook} tag.  But when I preview the page, I get an error message reading:

Code: Select all

Table 'tani_record.visitors' doesn't exist
I double checked the coding and tested it with a regular html web page and the guestbook stats show up at my website perfectly fine but it won't work with cms script.  What steps am I missing?  :'(

Re: How to include php script

Posted: Tue Aug 22, 2006 2:10 am
by Dr.CSS
Have you looked in the Documentation, it's in the tab up top.

I'm not so good with code unless it's html or CSS.

Re: How to include php script

Posted: Tue Aug 22, 2006 2:18 am
by calguy1000
just make sure your included scripts aren't re-using the $db bariable that may cause you grief.

Re: How to include php script

Posted: Tue Aug 22, 2006 3:33 am
by Essie
Hi Mark,
I did read the documentation.  That is why I am not sure what went wrong.

Hi Calguy1000,
Can you please be more specific as to what you mean by reusing $db Variable?  Or should I post the codes of the 2 included files here online?
Thanks.

Re: How to include php script

Posted: Thu Aug 24, 2006 7:21 pm
by Dee
CMSMS already has a variable called $db, representing the (ADOdb) database connection.
If your code also uses a (/re-uses the) (global) $db variable it gets overwritten so the queries get sent to the wrong db and the table cannot be found.