i have this code which doesnt work completely...csv file is generated but query string named as $s is not shown...
<?php
$count = 0;
foreach($_POST as $item)
{
$count += (is_array($item)) ? count($item) : 1;
}
// echo "Items = $count";
$db=$_POST["db"];
$skills = explode(",", $_POST["skills"]);
$table = explode(",", $_POST["table"]);
$city = explode(",", $_POST["city"]);
$region = explode(",", $_POST["region"]);
$country = explode(",", $_POST["country"]);
$latitude=$_POST["lat"];
$longitude=$_POST["long"];
$distance=$_POST["dist"];
$latitude*=0.01745;
$longitude=0.01745;
//print_r($skills);
$filename= strtotime("now").".csv";
/* @var $table type */
$f="SELECT 'first','last','email' UNION";
$s=$f." select first,last,email from $table[0] where skills regexp \"$skills[0]\"";
for($i=1;$i<count($skills);$i++)
{
$s.=" and skills regexp \"$skills[$i]\"";
}
for($i=0;$i<count($region);$i++)
if(!$region[$i]=="")
{
$s.=" and region regexp \"$region[$i]\"";
}
for($i=0;$i<count($city);$i++)
if(!$city[$i]=="")
{
$s.=" and city regexp \"$city[$i]\"";
}
for($i=0;$i<count($country);$i++)
if(!$country[$i]=="")
{
$s.=" and country regexp \"$country[$i]\"";
}
if(!$latitude=="")
$s.=" and acos(sin($latitude) * sin(Lati) + cos($latitude) * cos(Lati) * cos(Longi - ($longitude))) * 6371 <= $distance";
$s.="INTO OUTFILE '/var/tmp/$filename'
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\\n';";
$con=mysqli_connect("localhost","root","cutiepie_100",$db);
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$abc=mysqli_query($con, $s) or die('cannot show tables');
if($abc)
print_r($s);
echo $filename;
?>
not the $fiename is shown....