EDITOR PHP exucuting corrupt SQL where conditions

EDITOR PHP exucuting corrupt SQL where conditions

monkeyboymonkeyboy Posts: 60Questions: 19Answers: 0

EDITOR version 1.5.3 (yes it is old, but I am prohibited from upgrading)

EDITOR Code:
Editor::inst( $db, 'table1' )
->fields(
Field::inst( 'table1.id' ),
Field::inst( 'table1.Comments' ),
Field::inst( 'table1.archive' ),
Field::inst( 'table1.deleted' )
->where('table1.archive', 0)
->where('table1.deleted', 0)

Enabling the following line in Query.php
file_put_contents( '/var/www/html/error/query.log', $sql."\n", FILE_APPEND );

This is what is logged as the query
WHERE table1.archive = :where_0 AND table1.deleted = :where_1

As all rows have both archive AND deleted set to 0 - this returns nothing....

Any thoughts on WHY my "where deleted" is being changed to 1?

I am afraid I am dead in the water until I find a solution....

Answers

  • monkeyboymonkeyboy Posts: 60Questions: 19Answers: 0

    Turns out to be a typo - not a problem within editor.....

  • monkeyboymonkeyboy Posts: 60Questions: 19Answers: 0

    So - My Error: Where+0 and where_1 are placeholders for conditions, and not literal.

    It turns out that the problem has to do with the PHP library encoding of the data returned in the SQL call

    It seems that the JSON method FAILS and returns blank data if there are any non-printable characters in the database. Why would this be? We live in an international environment, and there are frequently special characters in datasets.

    Any suggestions on how to handle this?

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    edited March 2019

    Hi @monkeyboy ,

    It's probably because you haven't configured for UTF8 character sets - see here for the manual. If no joy, there's a few other threads in this forum - such as this and this.

    If no joy, please report back, and we can look into it further.

    Cheers,

    Colin

This discussion has been closed.