0

i need your help.. i having a problem with mysql, when i run UPDATE query, the data wont updated..

here's the structure..

id_demand   | nama_item | hargajual | hargabeli | barcode   | part_number   | nosc  | stat_gudang   | stat_po   | stat_gudang2  | request   | terima    | id_po | id_pr | id_npb    | id_ttb    | tanggal_request   | tanggal_terima    | final_stat    | tipe          

and here's the query...

$sqlx = "UPDATE item_demand SET stat_gudang = '1' AND id_pr = '$id_PR' WHERE id_npb = '2'";        
mysql_query($sqlx) or die(mysql_error());

I dont know why is my query doesnt work, can anybody help me?

1
  • The above query will throw an error message. Please always quote the error message as well Commented Jul 30, 2012 at 7:46

3 Answers 3

2

I'm assuming you didn't get any errors ? It probably means your where condition isn't verified then.

EDIT: I just saw your syntax was wrong. Your SET clauses must be separated by commas and not "AND". Thus : SET stat_gudang = '1', id_pr = '$id_PR'

Sign up to request clarification or add additional context in comments.

Comments

0

Make sure you are including data for the primary key and all foreign key constraints in your update.

Comments

0

you have used AND Bitween two field

stat_gudang = '1' AND id_pr = '$id_PR'

Change code

stat_gudang = '1', id_pr = '$id_PR'

$sqlx = "UPDATE item_demand SET stat_gudang = '1', id_pr = '$id_PR' WHERE id_npb = '2'";        
mysql_query($sqlx) or die(mysql_error());

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.