j4mie / idiorm

A lightweight nearly-zero-configuration object-relational mapper and fluent query builder for PHP5.
http://j4mie.github.com/idiormandparis/
2.01k stars 369 forks source link

How to ? #290

Closed ghost closed 8 years ago

ghost commented 8 years ago

please anyone help me with this simple query i jut started with idiorm but cant understand how i can do this using idiorm

$result = mysql_query("SELECT imdb_id FROM shows WHERE imdb_id IS NOT NULL");

while ($row = mysql_fetch_array($result)) {

$imdbdb = $row['imdb_id'];

}
bradrozier commented 8 years ago

Try something like

$result = ORM::for_table('shows')->select('imdb_id')->where_not_null('imdb_id')->find_many();

foreach($result as $row) {
    echo $row->imdb_id;
}

Hope this helps