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 7781513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:15:04+00:00 2026-06-01T19:15:04+00:00

Im using the following code to remove an entry from a table what i

  • 0

Im using the following code to remove an entry from a table what i want to do is to check if any value was deleted from the table.If one value is deleted,the script should print success else false.This is what i have achieved till now.Please help

<?PHP
    $mysqli = new mysqli("SQLHOST.COM","CLIENT","PASSWORD", "DNAME", 1234);

    if ($mysqli->connect_errno) {
        printf("Connect failed: %s\n", $mysqli->connect_error);
        exit();
    }
    else
    {

    printf("cONN Sucees");


    if ($result = $mysqli->query("DELETE FROM ktable WHERE code='value'")) {
        printf("Select returned %d rows.\n", $result->num_rows);


     printf($result->num_rows);
        $result->close();
    }

    }
    ?>
  • 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-06-01T19:15:06+00:00Added an answer on June 1, 2026 at 7:15 pm

    what you delete what you need to return is affected_rows http://www.php.net/manual/en/mysqli.affected-rows.php

    What you need to Replace

    if ($result = $mysqli->query("DELETE FROM ktable WHERE code='value'")) {
        printf("Select returned %d rows.\n", $result->num_rows);
    
    
        printf($result->num_rows);
        $result->close();
    }
    

    Working Code

    $value = ""; // Set To any Value
    $mysqli = new mysqli ( "SQLHOST.COM", "CLIENT", "PASSWORD", "DNAME", 1234 );
    if ($mysqli->connect_errno) {
        printf ( "Connect failed: %s\n", $mysqli->connect_error );
        exit ();
    } else {
        printf ( "cONN Sucees" );
        if ($mysqli->query (sprintf ( "DELETE FROM ktable WHERE code='%s'", mysqli_real_escape_string ( $mysqli, $value ) ) )) {
            printf ( "Affected Rows  %d rows.\n", $mysqli->affected_rows );
        }
    }
    

    You should have a working output

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following code to remove some specific nodes from xml file..It show
I am using the following code to remove a attribute from session List<User> l=(List<User>)
I'm using the following jQuery code to remove options from a select and it
I want to remove duplicates in a list using following code, but it does
I am using the following code to remove an element from the DOM tree:
I am trying to remove a file from path using following code. But my
I'm using the following code to take the value of one field, subtract it
I have extracted the following code from selenium IDE.(c# remote control) using System; using
I using following code: var search = 'test'; if ($('#sku').find(search) ){ //alert(search); $(document).find(search).css('color','red'); <TABLE>
I am using following code to check whether a check box on my website

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.