-
Notifications
You must be signed in to change notification settings - Fork 0
/
amf_products_list.php
51 lines (47 loc) · 958 Bytes
/
amf_products_list.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* Created by PhpStorm.
* User: ivan
* Date: 23.03.16
* Time: 10:14
*/
/**
* database host
*/
define ("host","localhost");
//define ("host","localhost");
/**
* database username
*/
define ("user", "root");
//define ("user", "root");
/**
* database password
*/
define ("pass", "");
//define ("pass", "");
/**
* database name
*/
define ("db", "mebli");
//define ("db", "mebli");
function get_product_list()
{
$db_connect=mysqli_connect(host,user,pass,db);
$query="SELECT goods_article, goods_name FROM goods WHERE factory_id=34";
if ($res=mysqli_query($db_connect,$query))
{
while ($row=mysqli_fetch_assoc($res))
{
$arr[]=$row;
}
$len=count($arr);
for ($i=0;$i<$len;$i++)
{
$str=$arr[$i]['goods_article'].", ".$arr[$i]['goods_name'].PHP_EOL;
file_put_contents('amf_list.txt',$str,FILE_APPEND);
}
}
}
get_product_list()
?>