New on LowEndTalk? Please Register and read our Community Rules.
mysql help - to fix some little errors
Hello, im looking for help to fix some mysql errors, well i find the error line but is not working, is for a site for cellphones, if you help me i would thank $$ you.
is mysql and php,
for example, i get this error on my log:
Problem during Record update, contact admin <-
API Response is STATUS: PROCESSED
and this is the code where gives error:
function update($table,$update,$condition){
$conn=$this->connect();
$query="update " . $table ." set " . $update ." where " . $condition;
$res=mysql_query($query);
if(!$res){
echo "Problem during Record update, contact admin";
} else {
return true;
}
}//end update()
Comments
Change echo "Problem during Record update, contact admin"; with echo "Problem during Record update, contact admin\nquery:".$query;
and paste the result
++++++++++++++++++++++++++++
Problem during Record update, contact admin
query:update tbl_imei_order set status='PROCESSED',unlock_code='PROCESSED',receive_date=2013-03-29 19:20:03 ,comments='NETWORK=61826051 PROVIDER=70647624 SUBPROVIDER=10073009 DEFREEZE=52518519' where reference_no=134237API Response is STATUS: PROCESSED
The problem is here: receive_date=2013-03-29 19:20:03
should be receive_date='2013-03-29 19:20:03'
Feel free to PM me with FTP data and the page you get the error and I can fix it in a minute or so.
Ok, i come to store but in 5 min ill be back and i pm you
$res=mysql_query($query) or die(mysql_error());
ok im back,
@serverian let me check code, to see if i can add that.
@yomero pero eso tiraria haria que el proceso se detenga no?
Cierto.
Una variante sería no usar el die() y usar un echo si tu intención es mostrar el error, aunque en ambientes de producción no es recomendable.
/spanish =D
@dedicados , deja que te regañe @joepie91
Joepie, please tell him shy he should use mysql_query
Oh yeah, that too. You should try to use PDO or mysqli and prepared statements, but that wasn't the question =P
I've checked the code. It uses proper PDO sql prepare in the client side. Only uses mysql_* in admin side.
Wrong:
Right:
@yo mero I know
@joepie91 thanks!
@serverian +1 @joepie91 a good practice granted But not always fully compatible just throwing it out there dev.mysql.com/doc/refman/5.1/en/identifiers.html
@serverian helped me, thanks
@dedicados, I'm online on skype.