$stmt = "insert into {CI}payment_logs (customer_id, invoice_id, invoice_total_amount, invoice_paid_amount, customer_paid_amount, invoice_payment_on ) "
. "values( ?, ?, ?, ?, ?, NOW() )";
$this->db->query( $stmt, array( $Customer_Id, $Invoice_Id, $Invoice_Total_Amount, $Deducted_Amount, $Paid_By_Cust ) );
$Log_Id = $this->db->insert_id(); // Returns Last Insert ID
Run Code Online (Sandbox Code Playgroud)
根据我的需要,这是正常工作,但我必须在特定条件下更新同一个表中每一行的状态.看看图片,
这是上述查询的插入数据.如您所见,invoice_total_amount
是总金额,但这个金额在第三行数据中完成.我必须更新该invoice_status
字段,因为paid
在高度点亮量SUM等于invoice_total_amount
和之后,我必须将状态更新为partial
.我尝试更新状态以添加触发器但不成功.
然后我尝试使用此命令的PHP.
update {CI}payment_logs
set invoice_status = IF( invoice_total_amount = sum(invoices_paid_amount), 'paid', 'partial' )
where log_id = ?
Run Code Online (Sandbox Code Playgroud)
但我没有得到invoices_paid_amount
invoice_id = 的SUM 5
,我尝试在IF条件下使用子查询,但它无效我的查询.
请帮我解决单查询或触发解决方案..
我有一个简单的HTML表.我想获得我点击的行的第一列的值.如果我点击第一行的任何地方它应该获得第一行的第一列的值,如果我点击第二行任何地方,它应该给第二列的第一列的值..这是我的表:
<table style="border:1px solid black" id="tab">
<tr>
<td style="border-right:1px solid black">Sachin</td>
<td>Yuvraj</td>
</tr>
<tr>
<td style="border-right:1px solid black">Virat</td>
<td>Gautam</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud) 我的多重上传与codeigniter有问题,
当我上传两次上传的文件以及如何调用上传到数据库的不同路径时.这是我的代码
调节器
public function upload(){
$catalog='catalog';
$userfile='userfile';
//for cover
$config['upload_path'] = './file/book/'; //Use relative or absolute path
$config['allowed_types'] = 'gif|jpg|png|';
$config['max_size'] = '100000';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
$this->upload->initialize($config);
//$c=$this->upload->do_upload($userfile);
//for catalog
$config['upload_path'] = './file/book/pdf/'; //Use relative or absolute path
$config['allowed_types'] = 'pdf';
$config['max_size'] = '1000000';
$this->load->library('upload', $config);
$this->upload->initialize($config);
//$cat=$this->upload->do_upload($catalog);
if(!$this->upload->do_upload($catalog) && $this->upload->do_upload($userfile)){
$error = array('error' => $this->upload->display_errors());
$this->load->view('uploadds', $error);
}else{
$this->load->model("book_model");
$this->book_model->addnewbook();
redirect('book/book');
}
Run Code Online (Sandbox Code Playgroud)
}
这个模型
function addnewbook(){
$fcat=array('upload_data' => $this->upload->data($userfile));
$fcatalog=array('upload_dataa' => …
Run Code Online (Sandbox Code Playgroud) 我想加密url参数值,如
http://www.sitename.com/index.php?userid=12546
Run Code Online (Sandbox Code Playgroud)
成
http://www.sitename.com/index.php?userid=SADFFHGFE
Run Code Online (Sandbox Code Playgroud)
防止机器人破解自动递增到数据库的用户ID,我不确定base64_encode
和的安全性base64_decode
.有没有办法做到这一点?
我正在尝试user_status
用条件更新提交的文件:
update pm_users
set user_status = if (
(select u.user_status from pm_users u where u.user_id = 3
) = '1', '0', '1' )
where user_id = 3
Run Code Online (Sandbox Code Playgroud)
表示如果user_status = 1
然后用0更新状态,如果用户状态为0,则为1.
我收到错误: You can't specify target table 'pm_users' for update in FROM clause
我认为这意味着我不能像上面那样使用这个查询同一个表吗?我不确定.
请帮助我以正确的方式前进,并让我纠正.
我试图用VueRouter实现VueJs.Home
组件显示日志消息但不显示模板部分.我收到以下错误:
Home.vue
<template>
<div class="wrap" id="app">
<h1 class="inline">Hello There</h1>
</div>
</template>
<script>
export default {
name: 'app',
data () {
return {
maps: []
}
},
mounted() {
console.log( 'Mounted Homepage' );
}
}
</script>
<style lang="scss">
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</style>
Run Code Online (Sandbox Code Playgroud)
routes.js
import Vue from 'vue';
import Home from './components/Home.vue';
import NotFound from './components/NotFound.vue';
const routes = [
{ name: 'home', path: '/', components: Home },
{ path: '*', …
Run Code Online (Sandbox Code Playgroud) 我已经构建了自定义电子邮件模板.并指定了一些变量{#paid_amount}
等等.
所有变量都被替换但paid_amount
不是预期的.我已经取代了这样的东西:
// Text file with HTML markups
$template = file_get_contents($template_url);
$paid_amount = '$1.00';
$pattern = array(
'/\{\#user_name\}/i',
'/\{\#paid_amount\}/i',
'/\{\#duration\}/i' );
$replacement = array(
$user_name,
$paid_amount,
$duration );
$new_template = preg_replace($pattern, $replacement, $template);
Run Code Online (Sandbox Code Playgroud)
它.00
在电子邮件中打印金额,如果我$
从打印金额中删除标志1.00
.我在Gmail中测试了它.以前有人遇到过这个吗?
即使我尝试$
但不工作.任何人都可以告诉我我错过了什么或为什么它不工作?
php ×4
javascript ×2
mysql ×2
codeigniter ×1
email ×1
email-client ×1
encryption ×1
html-email ×1
jquery ×1
sql ×1
vue-router ×1
vue.js ×1