mail($to, $subject, $message, $headers);
echo mail($to, $subject, $message, $headers) ? 'sended' : 'fail';
drop procedure if exists dump_image;
delimiter //
create procedure dump_image()
begin
declare this_id int;
declare cur1 cursor for select imageId from image;
open cur1;
read_loop: loop
fetch cur1 into this_id;
set @query = concat('select blob_field from image where imageId=',
this_id, ' into outfile "/tmp/xyz-', this_id,'.jpg"');
prepare write_file from @query;
execute write_file;
end loop;
close cur1;
end //
delimiter ;
select id,name, value from {table} where name = "";
select count (id) from {table} where value<{value_from_first}
$type = false;
foreach ($rows as $row){
if ($row['type']!=$type) {
$type = $row['type']; echo $type;
}
echo $row['name'];
}
static function distance($point1, $point2, $unit = 2 ) {
if (!$point2) return null;
if (!$point1) return null;
$point1 = explode(',', $point1);
$lon1 = $point1[0];
$lat1 = $point1[1];
$point2 = explode(',', $point2);
$lon2 = $point2[0];
$lat2 = $point2[1];
if ($lon1 == 0 || $lon2 == 0) {
return null;
}
$theta = $lon1 - $lon2;
$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
$dist = acos($dist);
$dist = rad2deg($dist);
$miles = $dist * 60 * 1.1515;
switch ($unit) {
case(self::UNIT_KM) :
$out = $miles * 1.609344;
break;
case(self::UNIT_MI) :
$out = $miles;
break;
case(self::UNIT_NA) :
$out = $miles * 0.8684;
break;
}
return $out;
}