Default data type for where condition?

Default data type for where condition?

jeq214jeq214 Posts: 7Questions: 3Answers: 1

I'm trying to pull in data with a where condition, but I'm not able to get any data with a certain field. If I remove the "chkitems.store" condition, it'll work. I've also tried setting the value with and without quotes. The field is set at var(char4) utf8mb4_general_ci collation. I was able to display data with a normal php query, but not with datatables.

My php:

Editor::inst( $db, "chkitems" )
->fields(
            Field::inst( "chkitems.store" ),
            Field::inst( "chkitems.date" ),
            Field::inst( "chkitems.check_num" ),
            Field::inst( "chkitems.menu_price" ),
            Field::inst( "chkitems.mod" ),
            Field::inst( "chkitems.reason" )
    )
    ->where( "chkitems.store", "1" )  //won't work with "1" or 1
    ->where( "chkitems.date", $date )
    ->process($_POST)
    ->json();

Any ideas what it could be?

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    Answer ✓

    var(char4)

    I don't recognize that. Do you mean "varchar(4)"? What does the data look like?

  • allanallan Posts: 63,893Questions: 1Answers: 10,531 Site admin

    I don't see any immediate reason why that where condition wouldn't work.

    Are there any errors reported back by the server?

    Thanks,
    Allan

  • jeq214jeq214 Posts: 7Questions: 3Answers: 1

    @tangerine Yes varchar(4). I should've checked the actual value. When I imported the data, I didn't realize that it was importing leading spaces. Thanks

This discussion has been closed.