-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgrids2.php
37 lines (25 loc) · 895 Bytes
/
grids2.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
<?php
$link = mysql_connect('localhost', 'techie17_user50', 'user50pass');
//if($link) echo 'link';
$db = mysql_select_db('techie17_trainsmart');
//if($db) echo 'db'; exit;
if($db){
try{
$result = mysql_query("SELECT f.id as fid,f.external_id as fext from facility f JOIN facility_report_rate frr
where frr.facility_external_id = f.external_id and frr.date = '2014-12-01'");
$ids = ''; $count = 0;
//if($result) echo 'has result: ' . mysql_num_rows($result); exit;
while ($row = mysql_fetch_assoc($result)) {
$id = $row['fid'];
$ext = "'" . $row['fext'] . "'";
$sql = "update facility_report_rate set facility_id = $id where facility_external_id =$ext AND date = '2014-12-01'";
//echo $sql; exit;
if(mysql_query($sql))
$count++;
}
} catch(Exception $e){
echo $e->getMessage();
}
echo $count;
}
?>