本文整理汇总了PHP中record_mysql_error函数的典型用法代码示例。如果您正苦于以下问题:PHP record_mysql_error函数的具体用法?PHP record_mysql_error怎么用?PHP record_mysql_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了record_mysql_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recordLogin
public static function recordLogin()
{
//RECORD THIS USER LOGIN, into user_logs
$mysql['login_server'] = db::escape(serialize($_SERVER));
$mysql['login_session'] = db::escape(serialize($_SESSION));
$mysql['login_error'] = db::escape(serialize($error));
$mysql['ip_address'] = db::escape($_SERVER['REMOTE_ADDR']);
$mysql['login_time'] = time();
if ($error) {
$mysql['login_success'] = 0;
} else {
$mysql['login_success'] = 1;
}
//record everything that happend during this crime scene.
$user_log_sql = "INSERT INTO 202_users_log\r\n\t\t\t\t\t\t\t\t SET user_name='" . $mysql['user_name'] . "',\r\n\t\t\t\t\t\t\t\t\t\tuser_pass='" . $mysql['user_pass'] . "',\r\n\t\t\t\t\t\t\t\t\t\tip_address='" . $mysql['ip_address'] . "',\r\n\t\t\t\t\t\t\t\t\t\tlogin_time='" . $mysql['login_time'] . "',\r\n\t\t\t\t\t\t\t\t\t\tlogin_success = '" . $mysql['login_success'] . "',\r\n\t\t\t\t\t\t\t\t\t\tlogin_error='" . $mysql['login_error'] . "',\r\n\t\t\t\t\t\t\t\t\t\tlogin_server='" . $mysql['login_server'] . "',\r\n\t\t\t\t\t\t\t\t\t\tlogin_session='" . $mysql['login_session'] . "'";
$user_log_result = mysql_query($user_log_sql) or record_mysql_error($user_log_sql);
if (!$error) {
$ip_id = INDEXES::get_ip_id($_SERVER['HTTP_X_FORWARDED_FOR']);
$mysql['ip_id'] = mysql_real_escape_string($ip_id);
//update this users last login_ip_address
$user_sql = "\tUPDATE \t202_users\r\n SET\t\t\tuser_last_login_ip_id='" . $mysql['ip_id'] . "'\r\n WHERE \tuser_name='" . $mysql['user_name'] . "'\r\n AND \t\tuser_pass='" . $mysql['user_pass'] . "'";
$user_result = _mysql_query($user_sql);
}
}
示例2: using
$campaigns_sql = "SELECT aff_campaign_id, aff_campaign_name FROM 202_aff_campaigns LEFT JOIN 202_aff_networks using(aff_network_id) WHERE 202_aff_campaigns.user_id = '" . $mysql['user_id'] . "' AND `aff_campaign_deleted`=0 AND `aff_network_deleted`=0 AND 202_aff_networks.user_id = 202_aff_campaigns.user_id";
$campaigns_result = $db->query($campaigns_sql);
$campaigns = array();
if ($campaigns_result->num_rows > 0) {
while ($campaigns_row = $campaigns_result->fetch_assoc()) {
$campaigns[] = array('id' => $campaigns_row['aff_campaign_id'], 'name' => $campaigns_row['aff_campaign_name']);
}
}
if (isset($_POST['get_rotators']) && isset($_POST['rotator_id']) && $_POST['get_rotators'] == true) {
?>
<select class="form-control input-sm" name="tracker_rotator">
<option value=""> -- </option>
<?php
$rotator_sql = "SELECT *\n\t FROM 202_rotators\n\t WHERE user_id='" . $mysql['user_id'] . "'\n\t ORDER BY `id` ASC";
$rotator_result = $db->query($rotator_sql) or record_mysql_error($rotator_sql);
while ($rotator_row = $rotator_result->fetch_array(MYSQL_ASSOC)) {
$html['rotator_name'] = htmlentities($rotator_row['name'], ENT_QUOTES, 'UTF-8');
$html['rotator_id'] = htmlentities($rotator_row['id'], ENT_QUOTES, 'UTF-8');
if ($_POST['rotator_id'] == $rotator_row['id']) {
$selected = 'selected=""';
} else {
$selected = '';
}
printf('<option %s value="%s">%s</option>', $selected, $html['rotator_id'], $html['rotator_name']);
}
?>
</select>
<?php
}
示例3: USING
?>
">
<div class="form-group" style="margin-bottom: 7px;">
<div class="col-xs-6 col-xs-offset-5">
<select class="form-control input-sm" name="aff_campaign_id_<?php
echo $count;
?>
" id="aff_campaign_id_<?php
echo $count;
?>
">
<option value="0"> -- </option>
<?php
$mysql['user_id'] = $db->real_escape_string($_SESSION['user_id']);
$aff_campaign_sql = "SELECT aff_campaign_id, aff_campaign_name, aff_network_name FROM 202_aff_campaigns LEFT JOIN 202_aff_networks USING (aff_network_id) WHERE 202_aff_campaigns.user_id='" . $mysql['user_id'] . "' AND aff_campaign_deleted='0' AND aff_network_deleted=0 ORDER BY aff_network_name ASC";
$aff_campaign_result = $db->query($aff_campaign_sql) or record_mysql_error($aff_campaign_sql);
while ($aff_campaign_row = $aff_campaign_result->fetch_assoc()) {
$html['aff_campaign_id'] = htmlentities($aff_campaign_row['aff_campaign_id'], ENT_QUOTES, 'UTF-8');
$html['aff_campaign_name'] = htmlentities($aff_campaign_row['aff_campaign_name'], ENT_QUOTES, 'UTF-8');
$html['aff_network_name'] = htmlentities($aff_campaign_row['aff_network_name'], ENT_QUOTES, 'UTF-8');
printf('<option value="%s">%s: %s</option>', $html['aff_campaign_id'], $html['aff_network_name'], $html['aff_campaign_name']);
}
?>
</select>
</div>
<div class="col-xs-1 remove-offer-grid">
<span class="fui-cross remove-offer" onclick="remove_new_campaign(<?php
echo $count;
?>
)"></span>
</div>
示例4: elseif
$mysql['order'] = 'ORDER BY `sort_breakdown_net` ASC';
}
$html['sort_breakdown_roi_order'] = 'sort_breakdown_roi asc';
if ($_POST['order'] == 'sort_breakdown_roi asc') {
$html['sort_breakdown_roi_order'] = 'sort_breakdown_roi desc';
$mysql['order'] = 'ORDER BY `sort_breakdown_roi` DESC';
} elseif ($_POST['order'] == 'sort_breakdown_roi desc') {
$html['sort_breakdown_roi_order'] = 'sort_breakdown_roi asc';
$mysql['order'] = 'ORDER BY `sort_breakdown_roi` ASC';
}
if (empty($mysql['order'])) {
$mysql['order'] = ' ORDER BY sort_breakdown_from ASC';
}
//grab breakdown report
$breakdown_sql = "SELECT * FROM 202_sort_breakdowns WHERE user_id='" . $mysql['user_id'] . "' " . $mysql['order'];
$breakdown_result = mysql_query($breakdown_sql) or record_mysql_error($breakdown_sql);
?>
<table cellpadding="0" cellspacing="1" class="m-stats">
<tr>
<th><a class="onclick_color" onclick="loadContent('/ajax/sort_hourly.php','','<?php
echo $html['sort_breakdown_order'];
?>
');">Time</a></th>
<th><a class="onclick_color" onclick="loadContent('/ajax/sort_hourly.php','','<?php
echo $html['sort_breakdown_clicks_order'];
?>
');">Clicks</a></th>
<th><a class="onclick_color" onclick="loadContent('/ajax/sort_hourly.php','','<?php
echo $html['sort_breakdown_leads_order'];
?>
示例5: mysql_real_escape_string
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/xtracks-app/bootstrap.php';
//get the aff_camapaign_id
$mysql['user_id'] = 1;
//see if it has the cookie, do whatever we can to grab to grab SOMETHING to tie this lead to
if ($_COOKIE['tracking202subid']) {
$mysql['click_id'] = mysql_real_escape_string($_COOKIE['tracking202subid']);
} else {
//ok grab the last click from this ip_id
$mysql['ip_address'] = mysql_real_escape_string($_SERVER['REMOTE_ADDR']);
$daysago = time() - 2592000;
// 30 days ago
$click_sql1 = "\tSELECT \t202_clicks.click_id \n\t\t\t\t\tFROM \t\t202_clicks\n\t\t\t\t\tLEFT JOIN\t202_clicks_advance USING (click_id)\n\t\t\t\t\tLEFT JOIN \t202_ips USING (ip_id) \n\t\t\t\t\tWHERE \t202_ips.ip_address='" . $mysql['ip_address'] . "'\n\t\t\t\t\tAND\t\t202_clicks.user_id='" . $mysql['user_id'] . "' \n\t\t\t\t\tAND\t\t202_clicks.click_time >= '" . $daysago . "'\n\t\t\t\t\tORDER BY \t202_clicks.click_id DESC \n\t\t\t\t\tLIMIT \t\t1";
$click_result1 = mysql_query($click_sql1) or record_mysql_error($click_sql1);
$click_row1 = mysql_fetch_assoc($click_result1);
$mysql['click_id'] = mysql_real_escape_string($click_row1['click_id']);
}
if ($mysql['click_id']) {
if ($_GET['amount']) {
$mysql['click_payout'] = mysql_real_escape_string($_GET['amount']);
}
$click_sql = "\tUPDATE \t\t\t\t\t202_clicks \n\t\t\t\t\tSET \t\t\t\t\t\tclick_lead='1', \n\t\t\t\t\t\t\t\t\t\t\t\tclick_filtered='0' ";
if ($mysql['click_payout']) {
$click_sql .= " , \tclick_payout='" . $mysql['click_payout'] . "' ";
}
$click_sql .= "\tWHERE \tclick_id='" . $mysql['click_id'] . "' ";
delay_sql($click_sql);
$click_sql = "\tUPDATE \t\t\t\t\t202_clicks_spy \n\t\t\t\t\tSET \t\t\t\t\t\tclick_lead='1', \n\t\t\t\t\t\t\t\t\t\t\t\tclick_filtered='0' ";
if ($mysql['click_payout']) {
$click_sql .= " , \tclick_payout='" . $mysql['click_payout'] . "' ";
示例6: elseif
}
$html['sort_referer_roi_order'] = 'sort_referer_roi asc';
if ($_POST['order'] == 'sort_referer_roi asc') {
$html['sort_referer_roi_order'] = 'sort_referer_roi desc';
$mysql['order'] = 'ORDER BY `sort_referer_roi` DESC';
} elseif ($_POST['order'] == 'sort_referer_roi desc') {
$html['sort_referer_roi_order'] = 'sort_referer_roi asc';
$mysql['order'] = 'ORDER BY `sort_referer_roi` ASC';
}
if (empty($mysql['order'])) {
$mysql['order'] = ' ORDER BY sort_referer_clicks DESC';
}
$db_table = '202_sort_referers';
$query = query('SELECT * FROM 202_sort_referers LEFT JOIN 202_site_domains ON (202_sort_referers.referer_id=202_site_domains.site_domain_id)', $db_table, false, false, false, $mysql['order'], $_POST['offset'], true, true);
$referer_sql = $query['click_sql'];
$referer_result = mysql_query($referer_sql) or record_mysql_error($referer_sql);
$html['from'] = htmlentities($query['from'], ENT_QUOTES, 'UTF-8');
$html['to'] = htmlentities($query['to'], ENT_QUOTES, 'UTF-8');
$html['rows'] = htmlentities($query['rows'], ENT_QUOTES, 'UTF-8');
?>
<table cellspacing="0" cellpadding="0" style="width: 100%; font-size: 12px;">
<tr>
<td width="100%;">
<a target="_new" href="/analyze/referers_download.php">
<strong>Download to excel</strong>
<img src="/xtracks-img/icons/16x16/page_white_excel.png" style="margin: 0px 0px -3px 3px;"/>
</a>
</td>
<td>
示例7: while
<li>You have not added any rotator.</li><?php
}
while ($row = $result->fetch_array(MYSQL_ASSOC)) {
$html['name'] = htmlentities($row['name'], ENT_QUOTES, 'UTF-8');
$html['id'] = htmlentities($row['id'], ENT_QUOTES, 'UTF-8');
printf('<li>%s - <a href="?delete_rotator_id=%s">remove</a></li>', $html['name'], $html['id']);
$rule_sql = "SELECT * FROM `202_rotator_rules` WHERE `rotator_id`='" . $row['id'] . "' ORDER BY `id` ASC";
$rule_result = $db->query($rule_sql) or record_mysql_error($rule_sql);
if ($rule_result->num_rows == 0) {
?>
<ul><li>You have not added any rules.</li></ul><?php
} else {
echo "<ul>";
while ($rule_row = $rule_result->fetch_array()) {
$criteria_sql = "SELECT * FROM `202_rotator_rules_criteria` WHERE `rule_id`='" . $rule_row['id'] . "' ORDER BY `id` ASC";
$criteria_result = $db->query($criteria_sql) or record_mysql_error($criteria_sql);
if ($criteria_result->num_rows > 0) {
$criteria = "You have " . $criteria_result->num_rows . " criteria added";
} else {
$criteria = "No criteria added";
}
?>
<li><?php
echo $rule_row['rule_name'] . " - " . $criteria;
?>
(<a href="" id="rule_details" data-id="<?php
echo $rule_row['id'];
?>
" data-toggle="modal" data-target="#rule_values_modal">Details</a>)</li>
<?php
}
示例8: mysql_real_escape_string
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/202-config/connect.php';
$mysql['chart_id'] = mysql_real_escape_string($_GET['chart_id']);
$chart_sql = "SELECT chart_xml FROM 202_charts WHERE chart_id='" . $mysql['chart_id'] . "'";
$chart_result = mysql_query($chart_sql) or record_mysql_error($chart_sql);
$chart_row = mysql_fetch_assoc($chart_result);
echo $chart_row['chart_xml'];
示例9: elseif
}
$html['sort_ip_roi_order'] = 'sort_ip_roi asc';
if ($_POST['order'] == 'sort_ip_roi asc') {
$html['sort_ip_roi_order'] = 'sort_ip_roi desc';
$mysql['order'] = 'ORDER BY `sort_ip_roi` DESC';
} elseif ($_POST['order'] == 'sort_ip_roi desc') {
$html['sort_ip_roi_order'] = 'sort_ip_roi asc';
$mysql['order'] = 'ORDER BY `sort_ip_roi` ASC';
}
if (empty($mysql['order'])) {
$mysql['order'] = ' ORDER BY sort_ip_clicks DESC';
}
$db_table = '202_sort_ips';
$query = query('SELECT * FROM 202_sort_ips LEFT JOIN 202_ips USING (ip_id)', $db_table, false, false, false, $mysql['order'], $_POST['offset'], true, true);
$ip_sql = $query['click_sql'];
$ip_result = mysql_query($ip_sql) or record_mysql_error($ip_sql);
$html['from'] = htmlentities($query['from'], ENT_QUOTES, 'UTF-8');
$html['to'] = htmlentities($query['to'], ENT_QUOTES, 'UTF-8');
$html['rows'] = htmlentities($query['rows'], ENT_QUOTES, 'UTF-8');
?>
<table cellspacing="0" cellpadding="0" style="width: 100%; font-size: 12px;">
<tr>
<td width="100%;">
<a target="_new" href="/analyze/ips_download.php">
<strong>Download to excel</strong>
<img src="/xtracks-img/icons/16x16/page_white_excel.png" style="margin: 0px 0px -3px 3px;"/>
</a>
</td>
<td>
<?php
示例10: trim
$from_day = trim($from[1]);
$from_year = trim($from[2]);
$to = explode('-', $_POST['to']);
$to = explode(':', $to[1]);
$to_hour = $to[0];
$to_minute = $to[1];
$to = explode('-', $_POST['to']);
$to = explode('/', $to[0]);
$to_month = trim($to[0]);
$to_day = trim($to[1]);
$to_year = trim($to[2]);
//if from or to, validate, and if validated, set it accordingly
if ($from != '' and (checkdate($from_month, $from_day, $from_year) == false or ($from_hour < 0 or $from_hour > 59 or !is_numeric($from_hour) or ($from_minute < 0 or $from_minute > 59 or !is_numeric($from_minute))))) {
$error['date'] = '<div class="error">Wrong date format, you must use the following military time format: <strong>mm/dd/yyyy - hh:mms</strong></div>';
} else {
$clean['user_pref_time_from'] = mktime($from_hour, $from_minute, 0, $from_month, $from_day, $from_year);
}
if ($to != '' and (checkdate($to_month, $to_day, $to_year) == false or ($to_hour < 0 or $to_hour > 59 or !is_numeric($to_hour) or ($to_minute < 0 or $to_minute > 59 or !is_numeric($to_minute))))) {
$error['date'] = '<div class="error">Wrong date format, you must use the following military time format: <strong>mm/dd/yyyy - hh:mm</strong></div>';
} else {
$clean['user_pref_time_to'] = mktime($to_hour, $to_minute, 59, $to_month, $to_day, $to_year);
}
}
echo $error['date'] . $error['user_pref_time_predefined'] . $error['user_pref_limit'] . $error['user_pref_show'];
if (!$error) {
$mysql['user_pref_time_predefined'] = mysql_real_escape_string($clean['user_pref_time_predefined']);
$mysql['user_pref_time_from'] = mysql_real_escape_string($clean['user_pref_time_from']);
$mysql['user_pref_time_to'] = mysql_real_escape_string($clean['user_pref_time_to']);
$user_sql = " UPDATE `202_users_pref`\n\t\t\t\t\tSET `user_pref_adv`='" . $mysql['user_pref_adv'] . "',\n\t\t\t\t\t\t\t`user_pref_ppc_network_id`='" . $mysql['user_pref_ppc_network_id'] . "',\n\t\t\t\t\t\t\t`user_pref_ppc_account_id`='" . $mysql['user_pref_ppc_account_id'] . "',\n\t\t\t\t\t\t\t`user_pref_aff_network_id`='" . $mysql['user_pref_aff_network_id'] . "',\n\t\t\t\t\t\t\t`user_pref_aff_campaign_id`='" . $mysql['user_pref_aff_campaign_id'] . "',\n\t\t\t\t\t\t\t`user_pref_text_ad_id`='" . $mysql['user_pref_text_ad_id'] . "',\n\t\t\t\t\t\t\t`user_pref_method_of_promotion`='" . $mysql['user_pref_method_of_promotion'] . "',\n\t\t\t\t\t\t\t`user_pref_landing_page_id`='" . $mysql['user_pref_landing_page_id'] . "',\n\t\t\t\t\t\t\t`user_pref_country_id`='" . $mysql['user_pref_country_id'] . "',\n\t\t\t\t\t\t\t`user_pref_ip`='" . $mysql['user_pref_ip'] . "',\n\t\t\t\t\t\t\t`user_pref_referer`='" . $mysql['user_pref_referer'] . "',\n\t\t\t\t\t\t\t`user_pref_keyword`='" . $mysql['user_pref_keyword'] . "',\n\t\t\t\t\t\t\t`user_pref_limit`='" . $mysql['user_pref_limit'] . "',\n\t\t\t\t\t\t\t`user_pref_show`='" . $mysql['user_pref_show'] . "',\n\t\t\t\t\t\t\t`user_pref_breakdown`='" . $mysql['user_pref_breakdown'] . "',\n\t\t\t\t\t\t\t`user_pref_chart`='" . $mysql['user_pref_chart'] . "',\n\t\t\t\t\t\t\t`user_cpc_or_cpv`='" . $mysql['user_cpc_or_cpv'] . "',\n\t\t\t\t\t\t\t`user_pref_time_predefined`='" . $mysql['user_pref_time_predefined'] . "',\n\t\t\t\t\t\t\t`user_pref_time_from`='" . $mysql['user_pref_time_from'] . "',\n\t\t\t\t\t\t\t`user_pref_time_to`='" . $mysql['user_pref_time_to'] . "',\n\t\t\t\t\t\t\t`user_pref_group_1`='" . $mysql['user_pref_group_1'] . "',\n\t\t\t\t\t\t\t`user_pref_group_2`='" . $mysql['user_pref_group_2'] . "',\n\t\t\t\t\t\t\t`user_pref_group_3`='" . $mysql['user_pref_group_3'] . "',\n\t\t\t\t\t\t\t`user_pref_group_4`='" . $mysql['user_pref_group_4'] . "'\n\t\t\t\t\tWHERE `user_id`='" . $mysql['user_id'] . "'";
$user_result = mysql_query($user_sql) or record_mysql_error($user_sql);
}
示例11: record_mysql_error
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/202-config/connect.php';
AUTH::require_user();
?>
<select class="form-control input-sm" name="platform_id" id="platform_id">
<option value="0"> -- </option>
<?php
$platform_sql = "SELECT *\n FROM 202_platforms\n GROUP BY `platform_name` ORDER BY `platform_name` ASC";
$platform_result = $db->query($platform_sql) or record_mysql_error($platform_sql);
while ($platform_row = $platform_result->fetch_array(MYSQL_ASSOC)) {
$html['platform_name'] = htmlentities($platform_row['platform_name'], ENT_QUOTES, 'UTF-8');
$html['platform_id'] = htmlentities($platform_row['platform_id'], ENT_QUOTES, 'UTF-8');
if ($_POST['platform_id'] == $platform_row['platform_id']) {
$selected = 'selected=""';
} else {
$selected = '';
}
printf('<option %s value="%s">%s</option>', $selected, $html['platform_id'], $html['platform_name']);
}
?>
</select>
示例12: printf
printf('<li>%s</li>', $html['aff_network_name']);
?>
<ul style="margin-top: 0px;"><?php
//print out the individual accounts per each PPC network
$mysql['aff_network_id'] = mysql_real_escape_string($aff_network_row['aff_network_id']);
$aff_campaign_sql = "\n\t\t\t\t\t\t SELECT *\n\t\t\t\t\t\t FROM `202_aff_campaigns`\n\t\t\t\t\t\t WHERE `aff_network_id`='" . $mysql['aff_network_id'] . "'\n\t\t\t\t\t\t AND `aff_campaign_deleted`='0'\n\t\t\t\t\t\t ORDER BY `aff_campaign_name` ASC\n\t\t\t\t\t\t";
$aff_campaign_result = mysql_query($aff_campaign_sql) or record_mysql_error($aff_campaign_sql);
while ($aff_campaign_row = mysql_fetch_array($aff_campaign_result, MYSQL_ASSOC)) {
$html['aff_campaign_name'] = htmlentities($aff_campaign_row['aff_campaign_name'], ENT_QUOTES, 'UTF-8');
$html['aff_campaign_payout'] = htmlentities($aff_campaign_row['aff_campaign_payout'], ENT_QUOTES, 'UTF-8');
printf('<li>%s · $%s</li>', $html['aff_campaign_name'], $html['aff_campaign_payout']);
?>
<ul style="margin-top: 0px;"><?php
$mysql['aff_campaign_id'] = mysql_real_escape_string($aff_campaign_row['aff_campaign_id']);
$landing_page_sql = "\n\t\t\t\t\t\t\t\t SELECT *\n\t\t\t\t\t\t\t\t FROM `202_landing_pages`\n\t\t\t\t\t\t\t\t WHERE `aff_campaign_id`='" . $mysql['aff_campaign_id'] . "'\n\t\t\t\t\t\t\t\t AND `landing_page_deleted`='0'\n\t\t\t\t\t\t\t\t AND landing_page_type='0'\n\t\t\t\t\t\t\t\t";
$landing_page_result = mysql_query($landing_page_sql) or record_mysql_error($landing_page_sql);
while ($landing_page_row = mysql_fetch_array($landing_page_result, MYSQL_ASSOC)) {
$html['landing_page_nickname'] = htmlentities($landing_page_row['landing_page_nickname'], ENT_QUOTES, 'UTF-8');
$html['landing_page_id'] = htmlentities($landing_page_row['landing_page_id'], ENT_QUOTES, 'UTF-8');
printf('<li>%s - <a href="?edit_landing_page_id=%s" style="font-size: 9px;">edit</a> - <a href="?delete_landing_page_id=%s" style="font-size: 9px;">remove</a></li>', $html['landing_page_nickname'], $html['landing_page_id'], $html['landing_page_id']);
}
?>
</ul><?php
}
?>
</ul><?php
}
?>
</ul>
</td>
</tr>
示例13: Run1MinCronjob
function Run1MinCronjob()
{
//check to run the 1minute cronjob, change this to every minute
$now = time();
$today_minute = date('i', time());
$today_hour = date('G', time());
$today_day = date('j', time());
$today_month = date('n', time());
$today_year = date('Y', time());
$today_minute = ceil($today_minute / 1);
$today_minute = $today_minute * 1;
if ($today_minute == 60) {
$today_minute = 0;
$today_hour++;
if ($today_hour == 24) {
$today_hour = 0;
}
}
//the click_time is recorded in the middle of the day
$cronjob_time = mktime($today_hour, $today_minute, 0, $today_month, $today_day, $today_year);
$mysql['cronjob_time'] = mysql_real_escape_string($cronjob_time);
$mysql['cronjob_type'] = mysql_real_escape_string('1min');
//check to make sure this click_summary doesn't already exist
$check_sql = "SELECT COUNT(*) FROM 202_cronjobs WHERE cronjob_type='" . $mysql['cronjob_type'] . "' AND cronjob_time='" . $mysql['cronjob_time'] . "'";
$check_result = mysql_query($check_sql) or record_mysql_error($check_sql);
$check_count = mysql_result($check_result, 0, 0);
if ($check_count == 0) {
//if a cronjob hasn't run today, record it now.
$insert_sql = "INSERT INTO 202_cronjobs SET cronjob_type='" . $mysql['cronjob_type'] . "', cronjob_time='" . $mysql['cronjob_time'] . "'";
$insert_result = mysql_query($insert_sql);
/* -------- THIS RUNS THE DELAYED QUERIES --------- */
$delayed_sql = "\n\t\t\tSELECT delayed_sql\n\t\t\tFROM 202_delayed_sqls\n\t\t\tWHERE delayed_time <=" . time() . "\n\t\t";
$delayed_result = _mysql_query($delayed_sql);
while ($delayed_row = mysql_fetch_assoc($delayed_result)) {
//run each sql
$update_sql = $delayed_row['delayed_sql'];
$update_result = _mysql_query($update_sql);
}
//delete all old delayed sqls
$delayed_sql = "DELETE FROM 202_delayed_sqls WHERE delayed_time <=" . time();
$delayed_result = _mysql_query($delayed_sql);
return true;
} else {
return false;
}
}
示例14: query
public static function query($sql)
{
if (!($ret = self::$_link->query($sql))) {
record_mysql_error($sql);
return false;
}
self::$_lastRowCount = $ret->rowCount();
self::$_queryLog[] = array('query' => $sql, 'rows' => $ret->rowCount());
return $ret;
}
示例15: USING
}
//echo error
echo $error['time'] . $error['user'];
//if there was an error terminate, or else just continue to run
if ($error) {
die;
}
// update regular clicks
$sql = "UPDATE 202_clicks LEFT JOIN 202_clicks_advance USING (click_id) \n\t\t\t\t\t\t LEFT JOIN 202_clicks_site USING (click_id) \n\t\t\t\t\t\t LEFT JOIN 202_aff_campaigns ON (202_clicks.aff_campaign_id = 202_aff_campaigns.aff_campaign_id)\n\t\t\t\t\t\t LEFT JOIN 202_aff_networks ON (202_aff_campaigns.aff_network_id = 202_aff_networks.aff_network_id)\n\t\t\t\t\t\t LEFT JOIN 202_ppc_accounts ON (202_ppc_accounts.ppc_account_id = 202_clicks.ppc_account_id)\n\t\t\t\t\t\t LEFT JOIN 202_ppc_networks ON (202_ppc_networks.ppc_network_id = 202_ppc_accounts.ppc_network_id)\n\t\t\tSET click_cpc='" . $mysql['click_cpc'] . "'\n\t\t\tWHERE 202_clicks.user_id='" . $mysql['user_id'] . "'";
if ($mysql['aff_network_id']) {
$sql .= " AND 202_aff_networks.aff_network_id='" . $mysql['aff_network_id'] . "' ";
}
if ($mysql['aff_campaign_id']) {
$sql .= " AND 202_clicks.aff_campaign_id='" . $mysql['aff_campaign_id'] . "' ";
}
if ($mysql['text_ad_id']) {
$sql .= " AND 202_clicks_advance.text_ad_id='" . $mysql['text_ad_id'] . "' ";
}
if ($mysql['landing_page_id']) {
$sql .= " AND 202_clicks.landing_page_id='" . $mysql['landing_page_id'] . "' ";
}
if ($mysql['ppc_network_id']) {
$sql .= " AND 202_ppc_networks.ppc_network_id='" . $mysql['ppc_network_id'] . "' ";
}
if ($mysql['ppc_account_id']) {
$sql .= " AND 202_clicks.ppc_account_id='" . $mysql['ppc_account_id'] . "' ";
}
$sql .= $mysql['method_of_promotion'];
$sql .= " AND click_time >=' " . $mysql['from'] . "' AND click_time <= '" . $mysql['to'] . "'";
$result = $db->query($sql) or record_mysql_error($sql);
echo '<p style="text-align: center; font-weight: bold;">' . $db->affected_rows . ' clicks updated.</p>';