close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

exporting doesnt work for one site but does for another

Thread began 5/24/2016 5:34 pm by Christopher West | Last modified 5/25/2016 11:37 pm by Christopher West | 351 views | 4 replies

Christopher WestCommunity Expert

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:
<?php require_once('../Connections/ecartdb.php'); ?>

<?php 
require_once('../webassist/mysqli/rsobj.php'); ?>
<?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");
$rows->execute();

while(!
$rows->atEnd()) {
    
$row = array($rows->getColumnVal("NewsLetterEmail"));
    
fputcsv($output$row);

$rows->moveNext();
}
$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 :)

Chris

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...