connection to foreign database
Posted: Wed Jun 21, 2006 2:04 pm
Hi,
I am pretty new to cmsmadesimple. So please apology for stupid questions..
I made a php script which i include using {include_php file="myscripts/index.php"}
From that script i would like to connect to a (foreign) database (mysql) to show the contents of a table in that db in my website.
Usually, in a normal website i do something like:
--------
$db = mysql_connect('host', 'mysql_user', 'mysql_password');
$sql = "SELECT * FROM TABLE";
$result = mysql_query($sql,$db);
$num_rows = mysql_num_rows($result);
while ($row = mysql_fetch_array($result)) {
echo "$row[0]";
}
mysql_close($db);
--------
For some reason this doesnt work. Can somebody help ?
Is there a global variable that links to the db where cmsmadessimple is stored ?
Thnx in advance
I am pretty new to cmsmadesimple. So please apology for stupid questions..
I made a php script which i include using {include_php file="myscripts/index.php"}
From that script i would like to connect to a (foreign) database (mysql) to show the contents of a table in that db in my website.
Usually, in a normal website i do something like:
--------
$db = mysql_connect('host', 'mysql_user', 'mysql_password');
$sql = "SELECT * FROM TABLE";
$result = mysql_query($sql,$db);
$num_rows = mysql_num_rows($result);
while ($row = mysql_fetch_array($result)) {
echo "$row[0]";
}
mysql_close($db);
--------
For some reason this doesnt work. Can somebody help ?
Is there a global variable that links to the db where cmsmadessimple is stored ?
Thnx in advance