exporting doesnt work for one site but does for another
Hi I am a little lost. I have a PHP function that writes all email address to an .csv file. This works fine for a latest project I am working on.
However when I duplicate the code to a previous website project it doesn't output any email addres. instead it outputs the actual SQL to the .csv file.
This is what is exactly outputted to the .csv file = SELECT NewsLetterEmail FROM newsletter<BR><BR>
Here is the code:
(I have made sure I uploaded the relevant files etc to the old website).
<?php require_once('../Connections/ecartdb.php'); ?>
<?php require_once('../webassist/mysqli/rsobj.php'); ?>
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=emails.csv');
$output = fopen('php://output', 'w');
$rows = new WA_MySQLi_RS("rows",$ecartdb,0);
$rows->setQuery("SELECT NewsLetterEmail FROM newsletter");
$row = array($rows->getColumnVal("NewsLetterEmail"));
$rows->moveFirst(); //return RS to first record
Why would it work for one website and not another? (Could it be that it works for my new website as I only have 3 email address in the database...and the old website has a few thousand?
Why would the old website output the SQL query (when the new website doesnt do this).
Well done a few tests, its not the size of the table in the database. and doesnt appear to be the database itself.
I wonder if its because (a) I am running it on a server that isnt using the latest PHP version? or (b) the old website was designed before MySQLi webassist server behaviors? However I had sure I uploaded the mysqli server behaviors folder and made sure it was connecting to a mysqli database connection (the file is a standalone php file so the website should have any impact on it.
Any thoughts would be great :)