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 #172765 is a reply to message #172759] Mon, 28 February 2011 11:40 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 2/28/2011 2:47 AM, P E Schoen wrote:
> "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

What is the value of 'name' + 1?

Associative array indexes are not numeric, so you can't increment them.

And although SQLLite can return an array with both indexed and
associative arrays, odbc_fetch_array() doesn't.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[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 19:14:56 GMT 2024

Total time taken to generate the page: 0.05067 seconds