0

This is part of my new script (PHP + MySQL). I can echo $price_exchange_update on output, so it's not empty or uncompilable data for MySQL (varchar-255).

this is worked cod:

mysqli_query($rate_db,"UPDATE rate_prices SET 
                       price_exchange_update = 'test 36'
                       WHERE ID='1'");

But if I use this:

mysqli_query($rate_db,"UPDATE rate_prices SET 
                       price_exchange_update = '$price_exchange_update'
                       WHERE ID='1'");

also this:

mysqli_query($rate_db,"UPDATE rate_prices SET 
                       price_exchange_update = ".$price_exchange_update."
                       WHERE ID='1'");

both of them not work. where am I wrong?

---- Update

I use simplehtmldom to grab date & time from other page. My variable is this:

$price_exchange_update = $html->find("span[id=updateTime]", 0);

echo $price_exchange_update;

and out put is: شنبه ۲۴ خرداد ۱۲:۳۸

I tested, if I use

mysqli_query($rate_db,"UPDATE rate_prices SET 
                       price_exchange_update = 'شنبه ۲۴ خرداد ۱۲:۳۸'
                       WHERE ID='1'");

It's worked. but when I try to update from the variable, it's not work.

Milad Abooali
  • 686
  • 1
  • 13
  • 30

0 Answers0