I’m building a snippet to select and display some data from a database that is on the same host as modx, but a seperate db and tables.
I’ve got the snippet like:
<?php
$conn2 = mysql_connect("localhost","myusername","mypassword") or die ("Cant connect to Database");
$db2 = mysql_select_db("mydatabase") or die ("database gone.");
$sql1 = "select field1.table1, field2.table2
from table1, table2
where field1.table1 = field2.table2";
$result = mysql_query($sql1) or die ("SQL1 not working, check snippet");
mysql_data_seek($result, 0);
$i = 0;
while($result_ar = mysql_fetch_assoc($result)){
?>etc etc etc....
On accessing the document Modx displays "« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« Execution of a query to the database failed - Table ’mydatabase.modx_site_templates’ doesn’t exist »
SQL: SELECT templatename,id FROM `modx_site_templates` "
Any help appreciated!