Delete multiple rows with checkbox form DB table?

Php $host = 'localhost'; // Host name $username = ''; // Mysql username $password = ''; // Mysql password $db_name = 'test'; // Database name $tbl_name = 'test_mysql'; // Table name // Connect to server and select databse. Mysql_connect($host, $username, $password) or die('cannot connect'); mysql_select_db($db_name) or die('cannot select DB'); $sql = 'SELECT * FROM `'. $tbl_name.

'`'; $result = mysql_query($sql);? > Delete multiple rows in mysql # Id Name Lastname Email " type="checkbox" id="checkbox" value=""> $value) { $sql = 'DELETE FROM `'. $tbl_name.

'` WHERE `id`='.(int)$id; mysql_query($sql); } header('Location: delete_multiple. Php'); exit(); } mysql_close();?

Theoretically it should work, but I have not tested Delete multiple rows in mysql # Id Name Lastname Email " type="checkbox" id="checkbox" value=""> $value) { $sql = 'DELETE FROM `'. $tbl_name. '` WHERE `id`='.(int)$id; mysql_query($sql); } header('Location: delete_multiple.

Php'); exit(); } mysql_close();?

Xss: 'hello'. Sql-injection: 'oh, hi! ' – knittl Jun 17 at 17:06 now I've fixed it or not?

– Noxt Jun 17 at 17:15 sqli looks fixed, xss could still happen (unescaped input from db, use htmlspecialchars to escape data for html output) – knittl Jun 17 at 17:17 I just looked only remove the code from the database – Noxt Jun 17 at 17:22.

Tested version: Change lines 45-55 to if($_POST'delete'){ $i = 0; while(list($key, $val) = each($_POST'checkbox')) { $sql = "DELETE FROM $tbl_name WHERE id='$val'"; mysql_query($sql); $i += mysql_affected_rows(); } // if successful redirect to delete_multiple. Php if($i > 0){ echo ''; } } The file should start with "" and "If you have the register_globals ini-directive on, it does not matter (It's still dangerous and bad style though).

1 jous, my skype tural.teyyuboglu. Please add me. I need live chat – Tural Teyyuboglu Jun 17 at 17:08.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions