Caching problem..?

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
nervino
Power Poster
Power Poster
Posts: 448
Joined: Sun Dec 28, 2008 12:15 pm
Location: Roma, Italy

Caching problem..?

Post by nervino »

Hello, I made a php page that queries a MySQL db and outputs the result of a simple query.

Here is my php file:

Code: Select all

$docroot = $_SERVER['DOCUMENT_ROOT'];
require $docroot . DIRECTORY_SEPARATOR . 'include.php';
if (!isset($gCms)) exit;
$db = cmsms()->GetDb();

$query = "SELECT * FROM mytable";
$dbresult = $db->Execute( $query );
      while ($dbresult && $row = $dbresult->FetchRow())
        {
            $mail_to = $row['mail_to'];
            echo '<br>to: '.$mail_to.'<br><br>';
        }
If I change with phpmyadmin the value of mail_to field, and I refresh the php page, I can't see the new value and the old one is displayed instead. To see the actual result of the query, I have to upload again the php file.

If I do not include cmsms files, and I make a standard connection to MySQL (see below), all works fine and the actual result of the query is displayed.

May anybody help me to understand where is the trick?

Thanks a lot

Standard connection that works:

Code: Select all

$username = "user";
$password = "pass";
$hostname = "localhost"; 


$dbhandle = mysql_connect($hostname, $username, $password);

$selected = mysql_select_db("mydb",$dbhandle);


$dbresult = mysql_query("SELECT * FROM mytable");

while ($row = mysql_fetch_array($dbresult)) {
   $mail_to = $row['mail_to'];
            echo '<br>a: '.$mail_to.'<br><br>';
}
Environment:
Ubuntu server 12.04
cmsms 1.11.3
php 5.3
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Caching problem..?

Post by calguy1000 »

including 'include.php' is not a supported way of interfacing with CMSMS.

And no, it's not a caching issue.
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.
nervino
Power Poster
Power Poster
Posts: 448
Joined: Sun Dec 28, 2008 12:15 pm
Location: Roma, Italy

Re: Caching problem..?

Post by nervino »

I see. Thank you
Post Reply

Return to “Developers Discussion”