SQL Query from external php file

goingtocry 18 Feb, 2013
Hi guys

I have been trying this out. I seem to remember a similar script working at stage, but I don't have a copy of this anymore...

In the WHERE SQL to add this:

<?php include 'APP_INCLUDES/load_vital_statistics.php' ?>
`establishment` = '<?php echo "$Establishment";?>'
AND
`reference` = '<?php echo "$reference";?>'


The "APP_INCLUDES/load_vital_statistics.php" Is my external file.
It works when I use the following script in Chronoforms:

<?php // Load Vital Statistics
  include 'APP_INCLUDES/load_vital_statistics.php'; ?>
<?php echo "$Establishment"; ?>


It echo's the variable but I get the following error when I run the chronoconnection???

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' `estab' at line 3 SQL=SELECT * FROM `MY DATABASE` WHERE `establishment` = 'XXXXX' AND `reference` = '52FF9GHIKY' ORDER BY `cf_id` LIMIT 0,20"


Any reason why? I have tried changing the comments, but no luck...

Thanks
GreyHead 19 Feb, 2013
Hi goingtocry,

This all looks OK apart from `MY DATABASE` - did you edit that? If so what was the original error message there?

Bob
This topic is locked and no more replies can be posted.