- Php Update Mysql Table Form
- Php Mysql Multiple Databases
- Php Mysql Multiple Update
- Php Mysql Multiple Queries
Active3 years, 4 months ago
i can update mysql database by one checkbox value 0/1 by ajax, but i don't know how to do this with multiple checkbox,
my code: index.php
ajax.php
Join Stack Overflow to learn, share knowledge, and build your career. How to Update Multiple Rows using PHP MySQL. We are well expertise with the PHP CRUD system by accessing MySQL using PHP Logic. We can get selected checkbox.
above code work only for one checkbox, what to do for 8 or 10 checkbox.
where to make change in script for switch1 switch2 switch3.
nish
nishnish
1 Answer
I have updated the answer:(I will suggest you to use mysqli_(), as mysql_() is depreciated. But I did not change anything regarding that.)
I have changed your index page only, your ajax.php should be the same.
Dipanwita KunduDipanwita Kundu1,65311 gold badge55 silver badges1414 bronze badges
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Php Update Mysql Table Form
Not the answer you're looking for? Browse other questions tagged phpjquerymysqlajaxcheckbox or ask your own question.
Active6 years, 2 months ago
I have a table called products, with an:
id: int, primary key, auto incrementproduct_name: varcharhighlighted: int (1 or 0)
So, I want the highlighted field to be totally updateable via my admin page, so whenever I get each product's (or row's) datas, I have a checkbox next to the product's name indicating if it's highlighted (1) or not (0).
This is my code:
For some reason, I'm getting the following error whenever I try to update the forms:
Thanks for your assistance in advance, I'm totally confused now, I've been struggling for hours now!
famefame
2 Answers
Hp windows 8 recovery usb. Change
to
isset() returns a boolean, and
foreach
expects an array.Also you are prone to mysql injection.
blake305blake305![Mysql Mysql](/uploads/1/2/6/0/126064703/828749364.png)
Php Mysql Multiple Databases
1,72922 gold badges1919 silver badges4949 bronze badges
additionaly to what blake305 said, you need to change this:
this will giv you an array in
$_POST['checkBox']
Driver impressora hp deskjet 840c windows 7 64 bits. - unfortunately your id is gone then.If thats necessary, you need to fetch every box explicitly:
name='checkBox_<?php echo $q['id']; ?>
and don't use
[]
Installer imprimante hp officejet g55 drivers. after the name since that has some meaning in PHP: the POST result will be an array instead of a string.add: this looks weird as well:
Axel Amthorname='checkBox['; ?><?php echo $q['id']; ?><?php echo ']'>
shouldn't that be name='checkBox[' . $q['id']. ']..
![Mysql update set multiple columns Mysql update set multiple columns](/uploads/1/2/6/0/126064703/221856258.jpg)
Php Mysql Multiple Update
9,83211 gold badge1818 silver badges4141 bronze badges