Re: [Phplib-users] DB putting results to strings
Brought to you by:
nhruby,
richardarcher
From: Matthew L. <lei...@ma...> - 2002-08-09 11:08:21
|
Hi, You can use the metadata method to get the list of column names. Or you can access the Record member directly and use extract. extract($db->Record) would work great except that there are numeric keys in $db->Record. I'm pretty sure PHP can be told to ignore these. Read the documentation or better yet, the source code. HTH, Matt On Fri, 9 Aug 2002, Stefan Melcher wrote: > Hello, > > donno if this is still possible with current version of PHPLib or > maybe an idea for the future. Can I automatically put a database > value into a string named after the column where the value belongs > to? > > Example: > $db=new DB_Example; > $query="SELECT * FROM exampleDB WHERE testID='test'"; > $db->query($query); > while ($db->next_record()) { > $$active_column_name=$db1->f("active_column_value"); > } > > The old version was: > $db=new DB_Example; > $query="SELECT * FROM exampleDB WHERE testID='test'"; > $db->query($query); > while ($db->next_record()) { > $column_name1=$db->f("column_value1"); > $column_name2>=$db->f("column_value2); > $column_name3=$db->f("column_value3"); > [...] > } > > > Any thoughts about it? > > Thanks and greetings, > Stefan > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Phplib-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phplib-users > -- ---------------------------------------------------------------- Matthew Leingang http://www.math.rutgers.edu/ Rutgers University lei...@ma... Department of Mathematics "This signature needs no quote." |