2 databases kills user defined tag/weird-interesting problem
Posted: Thu Jan 11, 2007 12:36 am
Hi I have a weird issue.
I have a CMS system setup. In addition, I have a second mysql database setup with some info I want to keep separate from the CMS database.
I have a page that displays data from the second database in a sortable grid.
On the page are a user defined tag and a global content block:
The global content bloc is for a footer at the bottom of every page, and that appears in my template
The user defined tag contains some php code that displays the grid/table. I noticed that whenever I make explicit mysql calls in this tag's php code, the footer disappears, and there is an CMS error in the source code.
global content bloc's error code:
string(61) "Smarty error: unable to read resource: "globalcontent:footer""
string(61) "Smarty error: unable to read resource: "globalcontent:footer""
global content bloc's code"
Grid tag's php:
//session junk here
session_start();
if(isset($_GET['direction'])){$direction=$_GET['direction'];}else{$direction='asc';}
if(isset($_GET['sort'])){$sort=$_GET['sort'];}else{$sort='lastname';}
if(isset($_SESSION['sort'])){
//read and write session logic here
}
echo'';
echo'';
echo '';
//header junk here from the database
echo'';
echo'';
echo'';
@MYSQL_CONNECT("server","user","password");
$sql='';
@mysql_select_db("selected_non_cms_database");
$sql="some sql here";
$result=MYSQL_QUERY($sql);
while ($row = mysql_fetch_assoc($result)) {
echo "";
//some junk here that I pull from the database
echo "";
}
mysql_free_result($result);
MYSQL_CLOSE();
Can anyone see where I have gone wrong? Why won't the footer show? I half suspect that my method of connecting to the mysql database is disabling the connection to the CMS connection to the CMS database, but I have no idea how to fix this if this is the case. At first I thought this was a session issue, but now I am not sure.
Any help would be appreciated.
Thanks,
Michael
I have a CMS system setup. In addition, I have a second mysql database setup with some info I want to keep separate from the CMS database.
I have a page that displays data from the second database in a sortable grid.
On the page are a user defined tag and a global content block:
The global content bloc is for a footer at the bottom of every page, and that appears in my template
The user defined tag contains some php code that displays the grid/table. I noticed that whenever I make explicit mysql calls in this tag's php code, the footer disappears, and there is an CMS error in the source code.
global content bloc's error code:
string(61) "Smarty error: unable to read resource: "globalcontent:footer""
string(61) "Smarty error: unable to read resource: "globalcontent:footer""
global content bloc's code"
Grid tag's php:
//session junk here
session_start();
if(isset($_GET['direction'])){$direction=$_GET['direction'];}else{$direction='asc';}
if(isset($_GET['sort'])){$sort=$_GET['sort'];}else{$sort='lastname';}
if(isset($_SESSION['sort'])){
//read and write session logic here
}
echo'';
echo'';
echo '';
//header junk here from the database
echo'';
echo'';
echo'';
@MYSQL_CONNECT("server","user","password");
$sql='';
@mysql_select_db("selected_non_cms_database");
$sql="some sql here";
$result=MYSQL_QUERY($sql);
while ($row = mysql_fetch_assoc($result)) {
echo "";
//some junk here that I pull from the database
echo "";
}
mysql_free_result($result);
MYSQL_CLOSE();
Can anyone see where I have gone wrong? Why won't the footer show? I half suspect that my method of connecting to the mysql database is disabling the connection to the CMS connection to the CMS database, but I have no idea how to fix this if this is the case. At first I thought this was a session issue, but now I am not sure.
Any help would be appreciated.
Thanks,
Michael