Skip to content Skip to sidebar Skip to footer

Export And Download My Php Table Data To Csv

I'm trying to get my datbase fetched data to Excel file for downloading it in execl or csv, but I'm having problems with exporting and also No datas are fetching to the csv .Here i

Solution 1:

Here you go!

change

$connect = new PDO('mysql:host=localhost;dbname=123', '123', 'invoice123');

to

$connect = mysqli_connect('localhost','123','invoice123','123');

and it should work, you can't use "PDO" with mysqli_query because both are different ways to connect to the database.

You can read more about PDO and mysqli here ->

https://websitebeaver.com/php-pdo-vs-mysqli

You should also enable error reporting. because when I tested the PHP codes it returned an errror.

Post a Comment for "Export And Download My Php Table Data To Csv"