FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » ODBC Connection
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: ODBC Connection [message #172759 is a reply to message #172746] Mon, 28 February 2011 07:47 Go to previous messageGo to previous message
P E Schoen is currently offline  P E Schoen
Messages: 86
Registered: January 2011
Karma:
Member
"sheldonlg" wrote in message
news:ikedis$8ou$1(at)news(dot)eternal-september(dot)org...

> Go to:
> www.php.net
> and look at
> odbc_fetch_array, odbc_fetch_row, odbc_result

With SQLite, you can use a qualifier to fetch the array as either numeric,
or associative, or both:
http://php.net/manual/en/function.mysql-fetch-array.php

array mysql_fetch_array ( resource $result [, int $result_type =
MYSQL_BOTH ] )

This may be helpful as well:
http://www.phpro.org/tutorials/Introduction-to-PHP-PDO.html

I had problems using associative arrays when, for instance, I wanted to
fetch a series of rows which might be

$db->exec("INSERT INTO tEmail (id,name,email) VALUES (
'$ID', '$Name', '$Email' )");

For some reason I was unable to use the associative indexes in a "for" loop
such as

for( $i = name; $i <= email; $i++)

but this was OK:

$line = 0;
while ($row = $qres->fetcharray(SQLITE3_BOTH)) {
for ($i = 0; $i < 2; $i++) {
$arr[$line][$i] = $row[$i];
}
$name = $arr[$line][1]; // should also be OK to use
$arr[$line][name];
$email = $arr[$line][2];
$line++;
}

I didn't spend much time with it. Since it worked with numeric indexes, I
was OK with that, but associative would have been clearer.

Paul
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: static vs global variable
Next Topic: SOCIAL NETWORK FOR PHP PLATFORM..
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 18:57:18 GMT 2024

Total time taken to generate the page: 0.05600 seconds