-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
  • 380
  • 4
  • 20

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,338
  • 11
  • 60
  • 91
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,680
  • 5
  • 37
  • 44
1

Try this :

mysqli_query($connect, "UPDATE specials SET title='san diego' WHERE id = 1");
Tanatos
  • 1,857
  • 1
  • 13
  • 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
  • 23,450
  • 12
  • 63
  • 93