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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:31:07+00:00 2026-05-23T09:31:07+00:00

I have need help in the below coding, right now it update the image

  • 0

I have need help in the below coding, right now it update the image every time i insert new trough form, i need it should update/insert image in each row not update the same image, kindly help .. code is below

<?PHP
if(isset($_POST['add_value'])){
    $sql ="INSERT INTO tb_special_offer (offer_price, offer_title, offer_desc, offer_link) VALUES ('"
        .addslashes($_REQUEST['offer_price'])."', '"
        .addslashes($_REQUEST['offer_title'])."', '"
        .addslashes($_REQUEST['offer_desc'])."', '"
        .addslashes($_REQUEST[offer_link])."')";
    $qry = mysql_query($sql) or die (mysql_error());
    //Image

    if($_FILES['offer_img']['name']){
        $uploaded_image = $_FILES['offer_img']['name'];
        $imgpath = "userfiles/specialoffer/";
        if(file_exists($imgpath.$uploaded_image)) unlink($imgpath.$uploaded_image);
        if(!move_uploaded_file($_FILES['offer_img']['tmp_name'], $imgpath.$uploaded_image)){
            $errMsg= "UPLOAD ERROR..!!!".$_FILES['offer_img']['name'];
        }
        else {
            $sql = "update tb_special_offer set offer_img='$uploaded_image'   ";
            $qry = mysql_query($sql) or die (mysql_error());
        }
    }

    header("Location: specialoffer?msg=Special Offer Added Successfully!");
    exit;
}
?>
  • 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-23T09:31:07+00:00Added an answer on May 23, 2026 at 9:31 am

    Your query means that all rows in your database get that image as value for the offer_img column. Update means just that: update a row.

    If you want to update a specific row, not every row, do something like this:

    update tb_special_offer set offer_img='$uploaded_image' where id=xxxx
    

    But I suspect you want to use an INSERT query. As you’ve not provided any more info I cannot write it for you, but it should be easy. Just read the manual, but it boils down to something like

    INSERT into tb_special_offer (offer_img) VALUES ('$uploaded_image')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have little snippet for validatin' my form. I need help to position the
I have a coding/maths problem that I need help translating into C#. It's a
I need help with the javascript below please. I have 2 text boxes and
Need your help on the below. I have a table where I have functions
I need help in writing a query, below i have written classes with needful
http://jsfiddle.net/nicktheandroid/ZSvHK/ I need help figuring out how to get this right, problems listed below.
EDITED*** Thank you for the help below. I understand $(this).children() now and I have
I need help with jQuery selectors. Say I have a markup as shown below:
I need help with wcf service. i have a ajax-enabled wcf service: public class
i need help with disk_total_space function.. i have this on my code <?php $sql=select

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.