我要查询的东西,有一个WHERE条件>=和=<但我有没有运气.这是在CODEIGNITER中.
这是mysql查询中的自然方式:
SELECT COUNT(payment.keyid) AS rec_count, `product_key`.`client_name`,
`product_key`.`contact_email`, `product_key`.`status`, `product_key`.`id`,
`payment`.`paymentdate`, (payment.id) as pid, `payment`.`subscription_type`
FROM (`product_key`)
LEFT OUTER JOIN `payment` ON `payment`.`keyid`=`product_key`.`id`
WHERE `payment`.`paymentdate` >= '2013-08-01'
AND `payment`.`paymentdate` =< '2013-08-31'
AND `status` = 'purchased'
GROUP BY `product_key`.`id`
ORDER BY `client_name` asc
Run Code Online (Sandbox Code Playgroud)
这就是我所拥有的:
return $this->db
->select('COUNT(payment.keyid) AS rec_count')
->select('product_key.client_name, product_key.contact_email, product_key.status, product_key.id, payment.paymentdate, (payment.id) as pid,payment.subscription_type')
->from('product_key')
->where('payment.paymentdate >=', $month_start)
->where('payment.paymentdate =<', $month_end)
->where('status', 'purchased')
->join('payment', 'payment.keyid=product_key.id', 'left outer')
->order_by('client_name', "asc")
->group_by('product_key.id')
->get()
->result(); …Run Code Online (Sandbox Code Playgroud) 我正在尝试申请autocomplete="off"我的WooCommerce结帐字段,但它不起作用.
结账表格有没有办法做到这一点?
我检查了文档,那里没有任何可用的东西.我也尝试将默认值设置为空,但它也不起作用.这是用户当然没有登录的时间.
更新:
我unset按照@smvax的建议尝试过,但它没有用.
add_filter('woocommerce_checkout_fields', 'default_values_checkout_fields');
function default_values_checkout_fields($fields) {
if (!is_user_logged_in()) {
unset($fields['billing_city']);
unset($fields['billing_first_name']);
unset($fields['billing_last_name']);
unset($fields['billing_company']);
unset($fields['billing_address_1']);
unset($fields['billing_address_2']);
unset($fields['billing_city']);
unset($fields['billing_postcode']);
unset($fields['billing_country']);
unset($fields['billing_state']);
unset($fields['billing_email']);
unset($fields['billing_phone']);
unset($fields['shipping_city']);
unset($fields['shipping_first_name']);
unset($fields['shipping_last_name']);
unset($fields['shipping_company']);
unset($fields['shipping_address_1']);
unset($fields['shipping_address_2']);
unset($fields['shipping_postcode']);
unset($fields['shipping_country']);
unset($fields['shipping_state']);
return $fields;
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢
我正在模仿网站的管理界面中的“管理订单”页面。这就像完全剥夺了后端的功能。
我坚持列出所有启用的付款方式。有谁知道我该怎么做到?
这是我的代码:
<?php
global $woocommerce;
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_style('jquery-ui-css', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
if(isset( $_GET['status_id'] )){
$update_order_id = $_GET['status_id'];
}
$data = array(
'order_id' => $update_order_id
);
// $result = wc_get_order_id_by_order_key();
$result = new WC_Order($update_order_id);
$order_date = explode(' ',$result->order_date);
$order_time = explode(':', $order_date[1]);
$order_time_hour = $order_time[0];
$order_time_minute = $order_time[1];
$order_date = $order_date[0];
$order_time_minute = $order_time[1];
$status = $result->post_status;
// print_r($result->get_payment_method());
$customer = new WC_Customer($update_order_id);
$payment_method_title = $result->payment_method_title;
$customer_email = $result->billing_email;
$customer_number = $result->customer_user;
$customer_first_name = $result->shipping_first_name;
$customer_details = get_post_meta($update_order_id);
// $customer_payment_title = …Run Code Online (Sandbox Code Playgroud) 我在这里通过Ajax POST传递了一个数组:
Array (
[name_dependents] =>
Array (
[0] => asd
[1] => hfg
)
[age_dependents] =>
Array (
[0] => 6
[1] => 6
)
[dob_dependents] =>
Array (
[0] => 2010-07-25
[1] => 2010-07-02
)
[dataString] => firstname=a&lastname=a&username=a&mobile_number=09176229999&password=blah&birth_month=01&birth_day=1&birth_year=1937&email=a@gmail.com&sec_question_uuid=1a78e916f8a2affa1d1de00be7e41f91&sec_answer=a&civil_status=32899cec496b4b25c43c8c4444f24403-married&gender=male&command=signup
)
Run Code Online (Sandbox Code Playgroud)
这是将它发送到php文件的ajax:
$.ajax({
type: 'POST',
url: 'functions.php',
data: {name_dependents:name_dependent_array, age_dependents:age_dependent_array, dob_dependents:dob_dependent_array, dataString:dataString},
success: function() {
$("#message").html('success');
window.setTimeout(function() {
$(".alert").fadeTo(1500, 0).slideUp(500, function(){
$(this).remove();
});
}, 5000);
}
});
Run Code Online (Sandbox Code Playgroud)
我的问题是,我似乎无法使循环工作将它们插入数据库:
$i = 0;
foreach($_POST['name_dependents]'] as $name_dependent){
echo $name_dependent = $name_dependent."<br />";
echo …Run Code Online (Sandbox Code Playgroud) 我正在创建一个适合我正在使用的MsSQL的DataTable的查询.这是我第一次使用MsSQL,所以我试图从我的MySQL中找出等效的MsSQL查询.
我做了一个自定义查询,将LIMITMySQL中的函数处理到MsSQL(希望如此).我在我的数据表中使用以下查询:
SELECT * FROM (
SELECT top 20 CAST(DATEPART(YEAR,[DeliveryDate]) as varchar) + ' Week ' + CAST(DATEPART(WEEK,[DeliveryDate]) AS varchar) AS week_name,
AVG(DATEDIFF(day, CONVERT(date, [UnloadDate]), CONVERT(date, [DeliveryDate]))) as Average_Delivery_Days
FROM [CARGODB].[dbo].[Cargo_Transactions]
WHERE [DeliveryDate] IS NOT NULL AND [DeliveryDate] != 0
AND [UnloadDate] IS NOT NULL AND [UnloadDate] != 0 AND [DeliveryDate] > [UnloadDate] AND [Deleted] = 0 and [StageID] = 'D'
AND [RouteID] IS NOT NULL AND [RouteID] != '' AND CONVERT(date, [DeliveryDate]) BETWEEN '2016-01-01' AND GETDATE()
AND …Run Code Online (Sandbox Code Playgroud) php ×4
mysql ×3
wordpress ×2
ajax ×1
checkout ×1
codeigniter ×1
datatable ×1
foreach ×1
jquery ×1
sorting ×1
sql ×1
sql-server ×1
woocommerce ×1