Ad

How Can I Get A List Of Results When Sqlite Returns More Than One Row?

- 1 answer

this is how my table looks:

key | driver  | machine     | result
-----------------------------------
1   | 1234    | abc_machine | pass
2   | 1234    | xyz_machine | fail

when a user selects '1234' from driver and all from machine things get a little messy. (user makes selection from a gui)

when i do:

$getConfig = `sqlite3 abc.db "SELECT machine FROM $table_name WHERE driver='$drvrSel'"`;

it gives me abc_machine xyz_machine.

I tried separating them using split(/ /, $getConfig), but does not work.

Thank you.

I am sorry if i asked this question in a wrong place. I tried finding right place but couldn't find it.

Ad

Answer

There might be a hidden tab or newline character in there. Look at the ascii value of the empty character between the strings and use that in your split call.

Ad
source: stackoverflow.com
Ad