Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7589473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:10:07+00:00 2026-05-30T20:10:07+00:00

I have a table in mysql and I’m printing it on screen by this

  • 0

I have a table in mysql and I’m printing it on screen by this code:

include ('mysql_con.php');
mysql_select_db("jaz", $con);

$res1 = mysql_query("SELECT * FROM hovno ORDER BY id DESC");

echo "<form action='delete_from_db.php' method='POST'>";
echo "<table border='1'>";
echo "<tr>";
echo "<td colspan='6'>" . "<input type='submit' value='Delete Article'>" . "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . "<b>" . "Delete" . "</b>" . "</td>";
echo "<td>" . "<b>" . "ID" . "</b>" . "</td>";
echo "<td>" . "<b>" . "Date" . "</b>" . "</td>";
echo "<td>" . "<b>" . "Title" . "</b>" . "</td>";
echo "<td>" . "<b>" . "Preview" . "</b>" . "</td>";
echo "<td>" . "<b>" . "Author" . "</b>" . "</td>";
echo "</tr>";
while($a=mysql_fetch_array($res1))  {
echo "<tr>";
echo "<td>" . "<input type='checkbox' name='checkbox[]' value='" . $a["id"] . "'>" . "</td>";
echo "<td>" . $a["id"] . "</td>";
echo "<td>" . $a["created"] . "</td>";
echo "<td>" . $a["title"] . "</td>";
echo "<td>" . $a["preview"] . "</td>";
echo "<td>" . $a["author"] . "</td>";
echo "</tr>";
                                }
echo "</table>";
echo "</form>";

So I’m putting id’s as checkbox values into array.
In another php file I wan’t to use this id’s in array to delete this records with those id’s. I don’t know what code to use for that buy i tried this:

<?php

include ('mysql_con.php');
mysql_select_db("jaz", $con) or die(mysql_error());

        $del[]=$_POST["checkbox"];

        $res1 = mysql_query("SELECT * FROM hovno WHERE id='$del'") or die(mysql_error());

    while($a = mysql_fetch_array($res1)){
            $b = $a["id"];
            mysql_query("DELETE FROM hovno WHERE id ='$b'") or die(mysql_error());
    }

?>

Any idea how to actually make it work? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T20:10:08+00:00Added an answer on May 30, 2026 at 8:10 pm
    foreach($_POST['checkbox'] as $key => $value) {
    
       // delete query here
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have MySQL table that doesn't have AUTO_INCREMENT field. In PHP I run this
I have a table in mysql like this Name Result T1_09_03_2010 fail T2_09_03_2010 pass
I have MySQL Table with an Order table in a DB this table has
I have a mysql table jobs . This is the basic structure of jobs
I have this table in mySQL intended to map some values to other values,
I have a table in mysql table with this structure id (primary index) title,
I have mysql table with data like this. record will have server with total
I have a table in MySQL with this format: (time = timestamp on insert)
I have a table in MySQL that looks like this: studentID subjectID anotherID anotherID2
Suppose I have a table (MySQL) like this: CREATE TABLE sessions ( session_id INT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.