0

I have this query

update warehouse set Items = CAST(0xvarbinarycode as varbinary(7680)) where AccountID = 'account'

If i run this query from SQL Management all is ok. But if i run from PHP... nothing happened.

Php Code.

$mynewitemstoadd = substr_replace($mycuritems, $newitemtobuy, ($testslot+2), 64);

//mynewitemstoadd is a valid varbinary (tested), connection to sql is ok (other query work fine).

$additem = "update [warehouse] set [Items]=CAST($mynewitemstoadd as varbinary(7680))  where [AccountId]='$account'";
$dbadditem = new DB_MSSQL;
$dbadditem->Database=$mu_db;
$dbadditem->query($additem);

If i print my query result return 1 (OK).

Thank you very much!

MeTa
  • 89
  • 1
  • 3
  • 11
  • Is your "$mu_db" OK? Did you try to see what's inside $additem variable print($additem);? It might got a bit puzzled up. If you think you are OK, add error handling to your code, see what it says and post it with your question –  Apr 01 '14 at 10:22
  • I print the query result and all is ok..yes $mu_db is fine. – MeTa Apr 01 '14 at 10:31
  • So if you print qres, and copy-past that result and execute against the DB it works? And it also works if you change $additem to (e.g.) "update [warehouse] set [field]='TEST ONLY'" or similar? –  Apr 01 '14 at 10:34
  • is similar... i don't know how i can return sql error. if i put mssql_get_last_message() sql tell me only he change the database (this $dbadditem->Database=$mu_db;) – MeTa Apr 01 '14 at 10:50
  • try adding if (!query... die(mssql_get_last_message()); –  Apr 01 '14 at 10:59

0 Answers0