Nepal12
Nepal12

Reputation: 593

Error updating mysql

I am sending data from an android app to save in my mysql database. My Codes are

$ress = mysql_query("UPDATE btrack_transaction SET delivery_date = $time, transaction_status = 2 , remark = $rem WHERE transaction_id = $t_id LIMIT 1");

And my dabase is as,

remark varchar(500) latin1_general_ci.

The problem is whenever I have $rem as a numbric value then database is updated but if I use any text then it wont.

Please help me.

Upvotes: 0

Views: 31

Answers (2)

fgallinari
fgallinari

Reputation: 133

Text should be wrapped by single quotes: ''

$ress = mysql_query("UPDATE btrack_transaction SET delivery_date = $time, transaction_status = 2 , remark = '$rem' WHERE transaction_id = $t_id LIMIT 1");

Upvotes: 1

Abhik Chakraborty
Abhik Chakraborty

Reputation: 44844

Make sure wrapping string data with single quote.

$ress = mysql_query("UPDATE btrack_transaction SET delivery_date = '$time', transaction_status = 2 , remark = '$rem' WHERE transaction_id = $t_id LIMIT 1")

Upvotes: 2

Related Questions