At 14:56 -0400 08/10/08, Igor Tandetnik wrote:
>Shaun R. <[EMAIL PROTECTED]> wrote:
>>  Anybody help me out here, trying to grab column info based on the
>>  columns name.  Examples i keep seeing people seam to use the colunm
>>  number but cant you access these values by the name?
>
>Not in general. Consider:
>
>select 1, 2, 3*5;
>
>What do you think the column names are here?
>
>However, see sqlite3_column_name[16], sqlite3_column_origin_name[16].
>With these, you can enumerate all the columns, get the name of each,
>figure out whether it's the one you want and thus obtain its number.

In PHP I'm doing something like this:

$dbh    = new PDO ("sqlite:mydb");
$resorg = $dbh->query ("select * from my_table where absid='$PTR_org'");
$orgs   = $resorg->fetch (PDO::FETCH_ASSOC);
$organisation = $orgs["name"];
$address = $orgs["address"];

I never use the column number.
-- 
-- tim
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to