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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:42:20+00:00 2026-06-16T15:42:20+00:00

I have a problem updating record on a table. Below is the detail: I

  • 0

I have a problem updating record on a table. Below is the detail:

I have a table named tbl_option, it has 2 field : option_name, option_value. The current table record is follow:

option_name | option_value
site_name   | MySite
site_desc   | About anything

I want to update both site_name and site_desc option_value, here is my php script to update the site_name and site_desc option_value:

require "include/config.php";
$name = "MyNewSitess";
$desc = "About Computer";

$query = mysql_query("UPDATE tbl_option SET option_value='$name' WHEREoption_name='site_name';# UPDATE tbl_option SET option_value='$desc' WHERE option_name='site_desc'");

if ($query) { echo "Saved"; }
else echo "Not saved : ".mysql_errno()." | ".mysql_error();

after executed I get the following error:

Not saved : 1064 | You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘UPDATE tbl_option SET option_value=’About Computer’ WHERE option_name=’site_desc’ at line 1

The record not updatd. But when I add (#) before the second UPDATE query :

<?php
...
$query = mysql_query("UPDATE tbl_option SET option_value='$name' WHERE option_name='site_name'; #UPDATE tbl_option SET option_value='$desc' WHERE option_name='site_desc'");
...
?>

It not showing any error. I get the following :

Saved

and the record is updated

What is the problem ?

Yes, I imitate the wordpress table concept but I don’t know how to do the UPDATE query to the table.

  • 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-16T15:42:21+00:00Added an answer on June 16, 2026 at 3:42 pm

    Change from

    $query = mysql_query("UPDATE tbl_option SET option_value='$name' WHEREoption_name='site_name';# UPDATE tbl_option SET option_value='$desc' WHERE option_name='site_desc'");
    

    to

    $query = mysql_query("UPDATE tbl_option SET option_value='$name' WHERE option_name='site_name'"); 
    
    if($query) $query = mysql_query("UPDATE tbl_option SET option_value='$desc' WHERE option_name='site_desc'");
    

    However, if this is a WordPress update, then you are better off posting this question here. You might just get a better solution 🙂

    Another option if you are doing this only once is to directly the console or a popular tool by the name of of PhpMyAdmin to do the updates.

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

Sidebar

Related Questions

Have a problem with updating an existing record of my DB. In my view
I have a little problem in updating date. My first table is DONOR donor-nic----username-----status
I have a problem updating MySQL rows using Jquery. This is my current code.
In the below C++ code, i am updating a field of emp table based
I have a problem in updating records to a derby db table with foreign
hey , I have a problem with updating a record using a domain service,
I have problem with updating a database record using EJB and JPA. Persistence provider:
I have a problem with updating record. I want to update 2 record in
i have a problem with updating my textview. i am making a c2dm app.
I have a table with 3 columns: ID, PARENT_ID, NAME PARENT_ID has a foreign

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.