Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


mysql help - to fix some little errors
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

mysql help - to fix some little errors

dedicadosdedicados Member
edited March 2013 in Help

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

  • dedicadosdedicados Member
    edited March 2013


    ++++++++++++++++++++++++++++

    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?

  • yomeroyomero Member
    edited March 2013

    @dedicados said: @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

  • netomxnetomx Moderator, Veteran

    @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

  • serverianserverian Member
    edited March 2013

    I've checked the code. It uses proper PDO sql prepare in the client side. Only uses mysql_* in admin side.

  • joepie91joepie91 Member, Patron Provider
    edited March 2013

    Wrong:

    WHERE fieldname = 'value'

    Right:

    WHERE `fieldname` = 'value'
  • netomxnetomx Moderator, Veteran

    @yo mero I know :p

    @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

  • dedicadosdedicados Member
    edited March 2013

    @serverian helped me, thanks

  • @dedicados, I'm online on skype.

Sign In or Register to comment.