How to include php script

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
Essie
Forum Members
Forum Members
Posts: 27
Joined: Sat Jan 21, 2006 8:13 pm

How to include php script

Post 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?  :'(
[url=http://"http://feeds.feedburner.com/Vancouver_Psychics_Journey]A Vancouver Psychic's Journey Blog[/url]
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: How to include php script

Post 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.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: How to include php script

Post by calguy1000 »

just make sure your included scripts aren't re-using the $db bariable that may cause you grief.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Essie
Forum Members
Forum Members
Posts: 27
Joined: Sat Jan 21, 2006 8:13 pm

Re: How to include php script

Post 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.
Last edited by Essie on Tue Aug 22, 2006 3:47 am, edited 1 time in total.
[url=http://"http://feeds.feedburner.com/Vancouver_Psychics_Journey]A Vancouver Psychic's Journey Blog[/url]
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm

Re: How to include php script

Post 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.
Post Reply

Return to “CMSMS Core”