复选框操作数据库的问题
表名:sale_order
表结构:
ID
order_id
name
quantity
Price
Address
Region
现在是这样,这个表内容我会显示在一个页面上,然后每条记录有个复选框,复选想要处理的记录,点提交
把复选的数据汇总处理
我的问题是怎么对选择的数据进行处理,对整个表的数据进行汇总我会。
回复讨论(解决方案)
不知道你要怎么处理,请详细说明。
例:
id,order_id, name,quantity,price,adderess,region
01,00001,王刚,10,500,深圳龙岗,HK
02,00002,王刚,5,200,深圳龙岗,HK
03,00003,刘二,6,300,东莞,HK
04,00004,刘二,5,400,东莞,CN
05,00005,王五,7,125,湖南,CN
06,00007,李四,1,454,北京,CN
一般我们汇总把人名一样的汇总在一起,汇总结果:
王刚,深圳龙岗,10X500****、5X200****,HK
刘二,东莞,6X300****、5X400****,HK
王五,湖南,5X400****,CN
李四,北京,1X454,CN
人名一样的把数量和价格汇总在一起,数量大于1的后面加*号,如果里面有一个HK,region就是HK
我现在就是想让操作的人自己选择要处理的数据进行处理。
在输出到页面的时候,给每条记录前加一个" />,我想你的问题可能就是这个value属性值,很简单,像我这样,把value=""中间再插入PHP代码,然后把你记录的数据通过echo输出,这样在点击处理数据之后,就可以在$_POST['checkbox']里找到数据了,你可以var_dump($_POST['checkbox']);看一下
stneo1990谢谢你的解答,可能我没说明白,把id或order_id赋值给value属性传过去,然后循环操作每记录,这个我知道。。。。。。。我现在主要是想对选择的数据进行汇总
SELECT * , group_concat(' ' , concat_ws( ' X ', `sku` , `quantity-purchased` ) , if(`quantity-purchased`> 1, '****' , ' ') ),group_concat(' ' , `order_id` , ' ') FROM ( select * from `sale_orders` order by `sku`) T WHERE `shipments` =0 AND `number` =$id AND (1<(select count(*) from `sale_orders` where `recipient-name`=T.`recipient-name`) OR `quantity-purchased`>1) GROUP BY `recipient-name` , `ship-address-1` ORDER BY length(group_concat( ' ' , concat_ws( ' X ', `sku` , `quantity-purchased` ) , ' ' )) DESC,`sku`

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Alipay PHP...

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.
