SQLite SELECT * FROM table WHERE id=? Troubles

There's a gap in my knowledge here and I can't find the answer on the internet.

Basically I'm making a node.js app that pushes entries from an SQLite Database using socket.io.

I'm using the implementation of SQLite here -> https://github.com/developmentseed/node-sqlite3

I'm trying to execute the statement:

db.serialize(function() {
        db.run("SELECT * FROM messages WHERE id=?", messageNum, function(err, row) {
            console.log(row.id);            
        });
    });

I can't find documentation. It's throwing this error at the moment:

Cannot read property 'id' of undefined

I basically guessed the syntax... Anyone know what it actually is?

EDIT

I have got around the problem with an extremely inefficient solution for now:

db.serialize(function() {

        db.each("SELECT id, msg, date FROM messages", function(err, row) {
            if(row.id === messageNum){
                console.log(row.id);    
            }
        });

    });

Would be good if someone could point me in the right direction at some point though, thanks.

Read the documentation – the run function does not return any data.

The each function supports parameters, just like run:

db.each("SELECT id, msg, date FROM messages WHERE id = ?",
        messageNum,
        function(err, row) {
            console.log(row.id);
        });