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

  • SEARCH
  • Home
  • 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 1062777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:40:50+00:00 2026-05-16T18:40:50+00:00

$html=; $sql=SELECT * FROM tiger;; $rs=mysql_query($sql); while($row=mysql_fetch_array($rs)){ $html.= ‘<tr><td align=left><img src=’.$row[‘image’].’ width=200 height=150 /></td>

  • 0
$html="";
$sql="SELECT * FROM tiger;";
$rs=mysql_query($sql);
while($row=mysql_fetch_array($rs)){

    $html.=
            '<tr><td align="left"><img src="'.$row['image'].'" width="200" height="150" /></td>
                <td align="center" style="font:bold">'.$row['name'].' </td>
            <td align="center"><input type="submit" name="Submit" value="Delete" />
            <input name="id" type="hidden" value="'.$row['id'].'" /> </td>

            </tr>'
            ;
    }
if($_REQUEST['Submit']){

$sql1="delete image from tiger where id='".$_REQUEST['id']."'";
$query=mysql_query($sql1);
}

Now this $html is echoed afterwards. so in output im getting 1st rhe image, then d name of the image and then a button. now what i want is wen i click the delete button the respective row is deleted from database. which is not happening in the above code as it is unable to fetch the respective id. so pleaser help how can i do that?

  • 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-16T18:40:51+00:00Added an answer on May 16, 2026 at 6:40 pm

    Did you add a form element to this table? I replaced $_REQUEST by $_POST, try to avoid using $_GET. A malicious user who knows your delete URL could trick you to click a link (e.g. tinyurl), which opens another set of links: the page deleting all your records. Try this:

    $html="";
    $sql="SELECT * FROM tiger;";
    $rs=mysql_query($sql);
    if(!$rs){
        echo 'Query failed...';
        // and log the error, mysql_error()
    }
    while($row=mysql_fetch_array($rs)){
    
        $html .=
                '<tr><td align="left"><img src="'.urlencode($row['image']).'" width="200" height="150" /></td>
                    <td align="center" style="font:bold">'.htmlentities($row['name']).' </td>
                <td align="center"><form action="" method="post"><input type="submit" name="Submit" value="Delete" />
                <input name="id" type="hidden" value="'.$row['id'].'" /></form> </td>
    
                </tr>'
                ;
        }
    if($_POST['Submit'] && isset($_POST['id']) && ctype_digit($_POST['id'])){
    
    $sql1="delete image from tiger where id='".$_POST['id']."'";
    $query=mysql_query($sql1);
    if(!$query){
       echo 'Error....';
       //and log mysql_error() somewhere
    }
    else{
       echo 'Deletion succesful';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The sql statement below will not run in SQLite: select * from A left
I'm trying to insert variables from an SQL result into a HTML form in
When i execute the following sql, nothing happens: select * from docs where freetext(*,
My SQL query is: SELECT * FROM 1910640 WHERE stype='P' OR stype='ERC' OR stype='PERC'
I have text stored in SQL as HTML. I'm not guaranteed that this data
I am trying to save html table to sql server table with unique name
I've read http://dbaspot.com/sqlserver-programming/463313-32-bit-clr-procedure-64-bit-sql-server.html Does that mean it's not possible to run a 32 bits
I'm a postgresql user and I'm trying to follow this : http://www.postgresql.org/docs/current/interactive/sql-createtrigger.html CREATE TRIGGER
I am working on sql server where i want to save html code into
Linq to SQL creates objects which are IQueryable and full of relations. Html Helpers

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.