Skip to content

Instantly share code, notes, and snippets.

@JasvinderSingh1
Last active May 27, 2019 18:59
Show Gist options
  • Save JasvinderSingh1/d059ad8b73a2651ddc68e38a09215e13 to your computer and use it in GitHub Desktop.
Save JasvinderSingh1/d059ad8b73a2651ddc68e38a09215e13 to your computer and use it in GitHub Desktop.
PHP
//compare a date with current date
$end_date = 2018-06-24
if((time()-(60*60*24)) < strtotime($end_date))
//simple curl
$ch = curl_init();
$curlConfig = array(
CURLOPT_URL => "http://www.example.com/yourscript.php",
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => array(
'field1' => 'some date',
'field2' => 'some other data',
)
);
curl_setopt_array($ch, $curlConfig);
$result = curl_exec($ch);
curl_close($ch);
// result sent by the remote server is in $result
// sorting data according to title with HTML
$result1 = mysql_query('SELECT * FROM `Post` WHERE `Cat_ID` = 4 ORDER BY `TITLE`');
$tmp = array();
$num_rows = mysql_num_rows($result1);
// echo "$num_rows Rows\n";
while($aa = mysql_fetch_array($result1)){
if(array_key_exists(strip_tags(str_replace('“','',str_replace('"','',$aa['Title']))),$tmp)){
$tmp[strip_tags(str_replace('“','',str_replace('"','',$aa['Title'].'_1')))] = $aa;
}else{
$tmp[strip_tags(str_replace('“','',str_replace('"','',$aa['Title'])))] = $aa;
}
}
ksort($tmp);
//churchtech
$result['male'] = $wpdb->get_var( "SELECT count(*) as c FROM `{$wpdb->prefix}rg_lead_detail` WHERE form_id=3 and field_number=58 and value like 'Male' and lead_id in (select lead_id from `{$wpdb->prefix}rg_lead_detail` where form_id=3 and field_number=122 and value like '".$pastor_id."')" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment