I’m a not programmer so please bear with me.
So you created a template that querys a database.
The data that the query is capturing is posted to a page using a snippit
then that snippit is displayed on a page published on the website.
That database isn’t a part of the database for the modx.
The following is just a example so I can see if I’m following your line of thought
So If I wanted to call the database’
---------------------------------------------------
not a complete statement just a few lines from the php page contactmedirectly.php
<?php session_start() ?>
<?
include "db_registrations.php";
// defaults
$name = "";
$email = "";
$city = "";
$comments= "";
$regtime= "";
if(isset($_POST[’submit’])){
$name = substr(trim(strip_tags($_POST[’name’])), 0, 100);
$email = substr(trim(strip_tags($_POST[’email’])), 0, 100);
$city = substr(trim(strip_tags($_POST[’city’])), 0, 100);
$comments = substr(trim(strip_tags($_POST[’comments’])), 0, 1000);
$regtime = time();
$tdisplay = date("F j Y h:i", $regtime);
if($_SESSION["captcha"]==$_POST["captcha"])
{
//CAPTHCA is valid; proceed the message: save to database, send by e-mail ...
$query = "insert into contacts (name, email, city, comments, regtime) values (’$name’, ’$email’, ’$city’, ’$comments’, ’$regtime’)";
$result = mysql_query($query) or die("Error: Query failed.
$query
" . mysql_error());
html encluded below this line to complete the form to fillout
-----------------------------------------
not a complete statement just a few lines from the next php page db_registrations.php
<?php
//$mysql_host_reg = "100.100.100.10";
$mysql_host_reg = "100.100.100.10";
$mysql_user_reg = "username";
$mysql_pass_reg = "password";
$mysql_db_reg = "nameofdatabase";
$link_reg = mysql_connect($mysql_host_reg, $mysql_user_reg, $mysql_pass_reg) or die("Error: Could not connect to $mysql_host_reg.
" . mysql_error());
mysql_select_db($mysql_db_reg) or die("Error: Could not select database $mysql_db_reg.");
?>