ytry

 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
<?php
chdir(dirname(__FILE__));
chdir('..');
require_once 'libs/database/Db.php';
$conn = MM_Db::getConnection('db', 'davidoff_coffee');
$conn->exec('DELETE FROM request');
$conn->exec('DELETE FROM user');
$conn->exec('DELETE FROM code');
for ($i=0; $i<5000; $i++)
{
$phone = '7910'.rand(1000000, 9999999);
$date = date('Y-m-d', strtotime(rand(2008, 2009).'-'.rand(1,12).'-'.rand(1, 28)));
$code = rand(0,834798789);
$is_ivr = rand(0,1);
$codeStatus = rand(0,3);
$sql = 'INSERT INTO request(date, phone, code, code_status, is_ivr) VALUES ';
$sql .='("'.$date.'", "'.$phone.'", "'.$code.'", "'.$codeStatus.'", "'.$is_ivr.'")';
echo $sql ." \n";
var_dump($conn->exec($sql));
var_dump($conn->errorInfo());
$sql = 'INSERT INTO user(create_date, phone, web_code_count, ivr_code_count, region_id) VALUES ';
$sql .='("'.$date.'", "'.$phone.'", "'.rand(0,30).'", "'.rand(0,11).'", "'.rand(1,105).'")';
echo $sql ." \n";
var_dump($conn->exec($sql));
var_dump($conn->errorInfo());
$sql = 'INSERT INTO stat(date, session_id, phone, result_place, duration) VALUES ';
$sql .='("'.$date.'", "'.rand(1, 500).'", "'.$phone.'", "'.rand(1, 3).'", "'.rand(1, 10).'")';
echo $sql ." \n";
var_dump($conn->exec($sql));
var_dump($conn->errorInfo());
}
//
?>