-1

I have a database called specials with a table called specials, the table has 6 rows, there are 3 records a record with an id of 1,2, and 3. One of the rows is called title. I have data already there but I want to update the data using a form. How ever my mysqli_query is not working.

Here is my code.

mysqli_query($connect, "UPDATE specials SET title=san diego WHERE id='1'");
user2684521
  • 350
  • 4
  • 19

4 Answers4

1

Assuming title is varchar and id is int

mysqli_query($connect, "UPDATE specials SET title='san diego' WHERE id=1");
Ing. Michal Hudak
  • 5,010
  • 9
  • 57
  • 90
1

you are inserting a string in varchar field so it should be quoted also try

mysqli_query($connect, "UPDATE specials SET title='san diego' WHERE id=1");

if datatype is varchar string should be quoted like title='san diego'

if int no need to quote (but you can use with quote) id = 1

Rakesh Sharma
  • 13,570
  • 4
  • 35
  • 42
1

Try this :

mysqli_query($connect, "UPDATE specials SET title='san diego' WHERE id = 1");
Tanatos
  • 1,817
  • 1
  • 12
  • 12
0

Try following:

mysqli_query($connect, "UPDATE specials SET title='san diego' WHERE id=1");

If your id is type of Int and title of Varchar

Manwal
  • 22,994
  • 11
  • 59
  • 91