Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $username = "root";
- $password = "xyz";
- $hostname = "localhost";
- $dbhandle = mysql_connect($hostname, $username, $password)
- or die("Unable to connect to MySQL");
- echo "Connected to MySQL<br>";
- $selected = mysql_select_db("xyz",$dbhandle)
- or die("Could not select examples");
- $row = 1;
- $file = fopen("check_tollfree_result.csv","w");
- $sql = "select number from dids";
- $result = mysql_query($sql);
- while($row1 = mysql_fetch_assoc($result)) {//echo "number: " . $row1["number"]. "<br>";
- $phoneno = $row1["number"];
- if (preg_match("/(\+?1)?(8(00|44|55|66|77|88)[2-9]\d{6})/", $phoneno)){
- $query = 'select count(billseconds) as minutes from cdrs where callednum="'.$phoneno.'" and callstart >= "2018-11-01 00:00:00" and callstart <= "2018-11-30 23:59:59"';
- echo $query."\n";
- $result_qur = mysql_query($query);
- while($rowcount = mysql_fetch_assoc($result_qur)) {
- $Total_minutes = $rowcount["minutes"];
- $line = $phoneno .",". $Total_minutes;
- }
- fputcsv($file , explode(',',$line));
- }else{
- $line2 = $phoneno .",". "NOT Matched";
- }
- }
- fclose($file);
- fclose($file2);
Add Comment
Please, Sign In to add comment