note 43749 added to ref.dbx

From: Date: Fri, 02 Jul 2004 00:12:46 +0000
Subject: note 43749 added to ref.dbx
Groups: php.notes 
Request: Send a blank email to php-notes+get-72292@lists.php.net to get a copy of this message
Would like to confirm that dbx is at least three times faster than adodb with my application. However, once loaded, adodb has much more features and probably performs better in some situations then dbx. One of the nice features that adodb has, is the way you can quickly make a dropdown menu from a query. Here's a similar function that works with a dbx result object: <?php // $result is the dbx_query result (It expects two fields) // $name is the name of the dropdown field // $selected is the option that should be selected // $firstrow takes a string like "myvalue:myname" // $attr can be used to add some extra attributes function dropDown($result, $name, $selected, $firstRow, $attr) { $s = '<select name="'.$name.'" '.$attr.'>'; if (is_string($firstRow)) { $row = explode(':', $firstRow); $s .= '<option value="'.$row[0].'">'.$row[1].'</option>'; } else $s .= '<option></option>'; foreach ($result->data as $row) { if ($row[0] == $selected) $s .= '<option value="'.$row[0].'" selected="selected">'.htmlspecialchars($row[1]).'</option>'; else $s .= '<option value="'.$row[0].'">'.htmlspecialchars($row[1]).'</option>'; } return $s.'</select>'; } ?> ---- Manual Page -- http://www.php.net/manual/en/ref.dbx.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43749 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43749&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43749&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#72292) next »