Search the web
Sign In
New User? Sign Up
metabase-dev · Metabase Development discussions list
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
in place of mysql_fetch_row   Message List  
Reply | Forward Message #1117 of 1151 |
Re: [metabase-dev] in place of mysql_fetch_row

Hello,

on 02/17/2005 03:42 AM idiroddi said the following:
> Before I tried Metabase for the first time (last week) i used:
>
> //create select list options (id,lname,fname)
> $options_agents=array(""=>"Select an Agent");
> while($row=mysql_fetch_row($result_agents))
> $options_agents[$row[0]]=$row[1].', '.$row[2];
>
>
> As I'm playing with Metabase, I tried with no success:
>
> //create select list options (id,lname,fname)
> $options_agents=array(""=>"Select an Agent");
> while($row=MetabaseFetchResult($database,$result_agents,0,"fname"))
> $options_agents[$row[0]]=$row[1].', '.$row[2];
>
> What is the portable mysql alternative?

for($line=0; !MetabaseEndOfResult($database, $result) &&
MetabaseFetchResultArray($database, $result, $row, $line); $line++)
$options_agents[$row[0]]=$row[1].', '.$row[2];



> Also, is there an alternative for:
> while($row=mysql_fetch_array($result)){
> $name = $row["name"];
> }

Sorry no. There is no portable way for fetching column values by name
because each database may change the case or truncate the returned
column names in an unpredictable way.

You can always use defines like this:

define("NAME", 0);

$name=$row[NAME];

Just take care that defines are global.


> BTW, as with your other classes, Great Great work!

Thank you. ;-)


--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html



Thu Feb 17, 2005 6:05 am

mallemos
Offline Offline
Send Email Send Email

Forward
Message #1117 of 1151 |
Expand Messages Author Sort by Date

Before I tried Metabase for the first time (last week) i used: //create select list options (id,lname,fname) $options_agents=array(""=>"Select an Agent"); ...
idiroddi
Offline Send Email
Feb 17, 2005
5:57 am

Hello, ... for($line=0; !MetabaseEndOfResult($database, $result) && MetabaseFetchResultArray($database, $result, $row, $line); $line++) ...
Manuel Lemos
mallemos
Offline Send Email
Feb 17, 2005
6:09 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help