traderinteractive /
cronus
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | #!/usr/bin/env php |
||
| 2 | <?php |
||
| 3 | use DominionEnterprises\Util\Arrays; |
||
| 4 | |||
| 5 | require_once __DIR__ . '/vendor/autoload.php'; |
||
| 6 | |||
| 7 | define('APPLICATION_ENV', 'production'); |
||
| 8 | |||
| 9 | $mariaDb = getMariaDatabase(); |
||
| 10 | |||
| 11 | $leadQuery = $mariaDb->query("select distinct(a.ad_id) |
||
| 12 | from traderadm.ad a, traderadm.ad_attrib aa |
||
| 13 | where a.ad_id=aa.ad_id |
||
| 14 | and a.realm_id =5 |
||
| 15 | and a.year in (2017, 2018) and a.make_id = 2316874 and a.price > 0 |
||
| 16 | and a.ad_status = 'A' |
||
| 17 | and aa.afa_id = 945587452 |
||
| 18 | and a.ad_id not in (select ad_id from ad_attrib where afa_id = 166799518 and value='Y')"); |
||
| 19 | |||
| 20 | // insert into ad_attrib (ad_id, afa_id, value, last_update, create_date) |
||
| 21 | foreach ($leadQuery as $lead) { |
||
| 22 | try { |
||
| 23 | $insertQuery = "insert into ad_attrib (ad_id, afa_id, value) values ({$lead['ad_id']}, 166799518, 'Y')"; |
||
| 24 | $mariaDb->execute($insertQuery); |
||
| 25 | $mariaDb->commit(); |
||
| 26 | catch(PDOException $e) { |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 27 | echo $e->getMessage(); |
||
| 28 | exit; |
||
| 29 | } |
||
| 30 | } |
||
| 31 | |||
| 32 | function getMariaDatabase() |
||
| 33 | { |
||
| 34 | return new PDO( |
||
| 35 | 'mysql:host=nebulous-mariadb-prodlb.tol.tilabs.io;dbname=traderadm;charset=utf8mb4', |
||
| 36 | 'coldfusion', |
||
| 37 | 'YmQ7QekluGYUvzaRpK7qrYw1' |
||
| 38 | ); |
||
| 39 | } |
||
| 40 | |||
| 41 |