Prepared SELECT IN () query

Source

<?php
    
    // "SELECT * FROM customer WHERE id IN (1,7)"
    
    // via Activerecord
    $customer = new \customer();
    $this->view->customers = $customer->find_in('id', [1,7]);

    // directly to the database object
    $this->view->result = $this->db->find_in('customer', 'id', [1,7]);
	

Result Activerecord (customer object)

Array
(
    [0] => Database\Barebone_me\Activerecords\customer Object
        (
            [tablename:Barebone\Activerecord:private] => customer
            [primary_key:Barebone\Activerecord:private] => id
            [pdo:Barebone\Activerecord:private] => Barebone\Database\Connectors\PDO Object
                (
                )

            [debug:protected] => 
            [joins:protected] => Array
                (
                )

            [selected_columns:protected] => Array
                (
                )

            [id] => 1
            [username] => Tester
            [password] => c098c977b6c9242f738ed521a63cb7e8
            [email] => test@example.com
            [created] => 2024-12-07
        )

    [1] => Database\Barebone_me\Activerecords\customer Object
        (
            [tablename:Barebone\Activerecord:private] => customer
            [primary_key:Barebone\Activerecord:private] => id
            [pdo:Barebone\Activerecord:private] => Barebone\Database\Connectors\PDO Object
                (
                )

            [debug:protected] => 
            [joins:protected] => Array
                (
                )

            [selected_columns:protected] => Array
                (
                )

            [id] => 7
            [username] => Tester
            [password] => c098c977b6c9242f738ed521a63cb7e8
            [email] => frank@test.nl
            [created] => 2025-10-28
        )

)

Result Database (stdClass object)

Array
(
    [0] => stdClass Object
        (
            [id] => 1
            [username] => Tester
            [password] => c098c977b6c9242f738ed521a63cb7e8
            [email] => test@example.com
            [created] => 2024-12-07
        )

    [1] => stdClass Object
        (
            [id] => 7
            [username] => Tester
            [password] => c098c977b6c9242f738ed521a63cb7e8
            [email] => frank@test.nl
            [created] => 2025-10-28
        )

)
  • Database\Barebone_me\Activerecords\customer

    Database\Barebone_me\Activerecords\customer extends Barebone\Activerecord
    • [P] $id : mixed
    • [P] $username : mixed
    • [P] $password : mixed
    • [P] $email : mixed
    • [P] $created : mixed
    • Barebone\Activerecord

      Barebone\Activerecord
      • [P] $tablename : string
      • [P] $primary_key : string
      • [P] $pdo : Barebone\Database\Connectors\PDO
      • [P] $debug : bool
      • [P] $joins : array
      • [P] $selected_columns : array
      • [M] __construct( mixed $data ) : void
      • [M] _throw_exception( PDOStatement $stmt, string $sql ) : void
      • [M] _pdo_debug_StrParams( $stmt ) : void
      • [M] is_protected_propertie( string $propertie ) : void
      • [M] debug( bool $debug ) : Barebone\Activerecord
      • [M] create( mixed $data ) : void
      • [M] __call( string $name, array $arguments ) : void
      • [M] __set( string $name, string $value ) : void
      • [M] __serialize() : array
      • [M] __unserialize( array $data ) : void
      • [M] escape( string $value ) : void
      • [M] propertie_exists( string $propertie ) : void
      • [M] get_columns() : void
      • [M] get_column( $columnname ) : void
      • [M] get_primary_key() : void
      • [M] set_data( mixed $data, bool $clean, array $protected ) : void
      • [M] get_data() : array
      • [M] get_by_id( int $id ) : void
      • [M] escapeIdentifier( string $identifier ) : string
      • [M] escapeOrderBy( array|string $order ) : string
      • [M] fetch_all( array $options ) : void
      • [M] all( array $options ) : void
      • [M] first() : void
      • [M] last() : void
      • [M] find( mixed $args ) : void
      • [M] find_by_sql( string $sql, array $params, string $objName ) : void
      • [M] find_in( string $key, array $array, string $type, bool $quote ) : void
      • [M] insert() : void
      • [M] update() : void
      • [M] save() : mixed
      • [M] delete() : void
      • [M] count( string $where ) : int
      • [M] still_exists() : bool
      • [M] is_valid( array $validators ) : void
      • [M] getProperties( bool $withdata ) : stdClass
      • [M] get_schema_path() : string
      • [M] validate_input( mixed $data ) : array
      • [M] drop_column( string $columnname ) : void
      • [M] to_grid( array $options, array $columns, Barebone\Controller $controller ) : void
        ↳ trait: Barebone\Activerecord\HtmlRecordRendering
      • [M] render_form( Barebone\Form\Decorators\DecoratorInterface $decorator, array $form_attr, array $options ) : void
        ↳ trait: Barebone\Activerecord\HtmlRecordRendering
      • [M] get_form( array $form_attr ) : void
        ↳ trait: Barebone\Activerecord\HtmlRecordRendering
      • [M] to_data_table( Barebone\View $view, array $options, array $formatter ) : void
        ↳ trait: Barebone\Activerecord\HtmlRecordRendering
      • [M] get_selected_columns() : void
        ↳ trait: Barebone\Activerecord\HtmlRecordRendering
      • [M] create_join_strings() : string
        ↳ trait: Barebone\Activerecord\ActiverecordJoinTrait
      • [M] join( Barebone\Activerecord $foreign_table, string $primary_key, string $foreign_key, string $join_type ) : void
        ↳ trait: Barebone\Activerecord\ActiverecordJoinTrait
      • [M] left_join( Barebone\Activerecord $foreign_table, string $primary_key, string $foreign_key ) : void
        ↳ trait: Barebone\Activerecord\ActiverecordJoinTrait
      • [M] right_join( Barebone\Activerecord $foreign_table, string $primary_key, string $foreign_key ) : void
        ↳ trait: Barebone\Activerecord\ActiverecordJoinTrait
      • [M] inner_join( Barebone\Activerecord $foreign_table, string $primary_key, string $foreign_key ) : void
        ↳ trait: Barebone\Activerecord\ActiverecordJoinTrait
      • [M] outer_join( Barebone\Activerecord $foreign_table, string $primary_key, string $foreign_key ) : void
        ↳ trait: Barebone\Activerecord\ActiverecordJoinTrait
      • [M] toArray() : void
        ↳ trait: Barebone\Activerecord\ActiverecordDataConversionTrait
      • [M] toObject() : void
        ↳ trait: Barebone\Activerecord\ActiverecordDataConversionTrait
      • [M] toJSON( bool $withdata ) : string|bool
        ↳ trait: Barebone\Activerecord\ActiverecordDataConversionTrait
      • [M] toTable( array $options ) : Barebone\HTML\TTable
        ↳ trait: Barebone\Activerecord\ActiverecordDataConversionTrait
      • [M] getHash() : string
        ↳ trait: Barebone\Activerecord\ActiverecordDataConversionTrait