I have a UDT where I need to pull data from another database, which works fine if I use it in the body.
But when I try and use it in the header, it kills the page with the following error:
"Warning: Invalid argument supplied for foreach() in /Volumes/DATA/Html/cms/lib/content.functions.php on line 234"
This happens if the tag is placed anywhere higher than the Breadcrumbs Tag.
How do I overcome this ??
mysql_select_db() in UDT breaks the page
-
- Forum Members
- Posts: 57
- Joined: Sun Mar 25, 2007 7:42 am
Re: mysql_select_db() in UDT breaks the page
Well
It seens like a common PHP error, probably related with the foreach parameter that should be an array.
You must supply at least a part of the UDT code so we can understand what´s happening.
Anyway it´s really strabge since the value is being tested in content.functions.php on 1.5.2
Please provide more information, PHP, CMSMS version, and a piece of the udt
Regards
G
It seens like a common PHP error, probably related with the foreach parameter that should be an array.
You must supply at least a part of the UDT code so we can understand what´s happening.
Anyway it´s really strabge since the value is being tested in content.functions.php on 1.5.2
Please provide more information, PHP, CMSMS version, and a piece of the udt
Regards
G
-
- Forum Members
- Posts: 57
- Joined: Sun Mar 25, 2007 7:42 am
Re: mysql_select_db() in UDT breaks the page
Hello G;
Thanks so much, actually just adding the following UDT anywhere above the breadcrumbs in the template kills the page:
I have commented out line by line and tested which line is the killer and it's:
I am guessing that this is over-writing the cms database select ?!
P
Thanks so much, actually just adding the following UDT anywhere above the breadcrumbs in the template kills the page:
Code: Select all
## UDT db_test ###
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("yrdbname") or die(mysql_error());
Code: Select all
mysql_select_db("yrdbname") or die(mysql_error());
P
Re: mysql_select_db() in UDT breaks the page
At the end of your UDT have you closed your MySql connection and reopened the CMSMS connection?
mysql_close ($my_dbconn); <- use whatever your connection is called
adodb_connect();
Nullig
mysql_close ($my_dbconn); <- use whatever your connection is called
adodb_connect();
Nullig
-
- Forum Members
- Posts: 57
- Joined: Sun Mar 25, 2007 7:42 am
Re: mysql_select_db() in UDT breaks the page
Hi;
Yes, I closed the connection and also freed up the memory:
mysql_close();
mysql_free_result()
But anyway, I have given up and decided to add a table to the existing database instead, so it's not really solved !
P
Yes, I closed the connection and also freed up the memory:
mysql_close();
mysql_free_result()
But anyway, I have given up and decided to add a table to the existing database instead, so it's not really solved !
P
Re: mysql_select_db() in UDT breaks the page
crankshaft,
Take a look at this topic, it might help you out:
http://forum.cmsmadesimple.org/index.ph ... #msg114472
Take a look at this topic, it might help you out:
http://forum.cmsmadesimple.org/index.ph ... #msg114472
Re: mysql_select_db() in UDT breaks the page
Did you add the:
adodb_connect();
to reopen the CMSMS db connection?
Nullig
adodb_connect();
to reopen the CMSMS db connection?
Nullig