Answer the question
In order to leave comments, you need to log in
How to save data from MySQL database to excel using php?
Wrote a simple script:
<?php
header('Content-Type: text/html; charset=utf-8');
$host='localhost';
$database='lalala';
$user='lalala_user';
$pswd='12345';
$dbh = mysql_connect($host, $user, $pswd) or die("Не могу соединиться с MySQL.");
mysql_select_db($database) or die("Не могу подключиться к базе.");
$query = "SELECT * FROM `oc_product`";
$res = mysql_query($query);
while($row = mysql_fetch_array($res)){
echo "Номер: ".$row['product_id']."<br>\n";
echo "Модель: ".$row['model']."<br>\n";
echo "Артикул: ".$row['sku']."<br>\n";
echo "Цена: ".$row['price']."<br>\n";
echo "Картинка: ".$row['image']."<br>\n";
echo "Производитель(id): ".$row['manufacturer_id']."<br><hr>\n";
}
mysql_close($dbh);
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question