Export csv to folder?

QuestionsExport csv to folder?
Mario asked 7 years ago

Is it possible with phpgrid to export fresh data to csv to a folder on the server?

1 Answers
selectcase.biz answered 7 years ago

I solved it with:

<?php
include_once("configure.php");

$host = "localhost";
$username = DB_SERVER_USERNAME;
$password = DB_SERVER_PASSWORD;
$dbname = DB_DATABASE;

// open connection to mysql database
$connection = mysqli_connect($host, $username, $password, $dbname) or die("Connection Error " . mysqli_error($connection));

// fetch mysql table rows
$sql = "select * from plusinfo_intraship";
$result = mysqli_query($connection, $sql) or die("Selection Error " . mysqli_error($connection));

$fp = fopen('delisprint.csv', 'w');

while($row = mysqli_fetch_assoc($result))
{
fputcsv($fp, $row);
}

fclose($fp);

//close the db connection
my

Your Answer

9 + 17 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?