RE: [Phplib-users] fetch_array
Brought to you by:
nhruby,
richardarcher
From: Layne W. <la...@of...> - 2003-01-15 21:02:22
|
> > $db->query("SELECT sid FROM active_sessions LIMIT 1"); > > $db->next_record(); > > > > echo $db->Record["sid"]; > > > > next_record() puts the array in $db->Record. > > Is that "legal"? I had avoided doing that because I was > afraid that it might break in future releases, sticking > instead only to the documented API. I suppose it isn't proper OOP - I've seen other people's code that does the same, so I hadn't thought too much about it. If I'm only going to use the data once or twice, I'll use $db->f(), but when I use the data many times over I want to save the function call and access an array directly. I've modified my own next_record() to optionally return the record array: $db->query("..."); while($record = $db->next_record(true)) { ... } Is this a shortcut that is useful and worthy of inclusion in the standard distribution? Layne Weathers Ifworld Inc. |