note 27890 added to function.udm-find

From: Date: Mon, 23 Dec 2002 16:50:29 +0000
Subject: note 27890 added to function.udm-find
Groups: php.notes 
Request: Send a blank email to php-notes+get-41227@lists.php.net to get a copy of this message
Here is a small snipet of code that will perform a search on mnogosearch and (in not so pretty a way) display the results. Note that it appears that UDM_PARAM_FIRST_DOC starts at 1, but perhaps should be 0. <?php $searchText = trim($_GET['search']); $mnogo = udm_alloc_agent ('mysql://me:secret@localhost/mnogosearch/'); $mResult = udm_find($mnogo,$searchText); $totalMatches = udm_get_res_param ($mResult,UDM_PARAM_FOUND); $pageSize = udm_get_res_param ($mResult,UDM_PARAM_NUM_ROWS); $firstRow = udm_get_res_param ($mResult,UDM_PARAM_FIRST_DOC); $lastRow = udm_get_res_param ($mResult,UDM_PARAM_LAST_DOC); echo "Your search for <b>$searchText</b> resulted in <b>$totalMatches</b> matches"; echo "The result set (pagesize) is <b>$pageSize</b>\n"; echo "The first doc is row <b>$firstRow</b> and the last doc is <b>$lastRow</b>\n"; $row=0; for ($i=$firstRow-1;$i<$lastRow;$i++) { $row++; echo "Match $row:"; echo 'Url: '; $url = udm_get_res_field ($mResult,$i,UDM_FIELD_URL); echo "<a href=\"$url\">$url</a>"; echo "\nTitle: <b>"; echo udm_get_res_field ($mResult, $i,UDM_FIELD_TITLE); echo "</b>\nMeta Desc:"; echo udm_get_res_field ($mResult, $i,UDM_FIELD_DESC); echo "\nPage Text: <b>\n"; echo udm_get_res_field ($mResult, $i,UDM_FIELD_TEXT); echo "</b>\n<hr>\n"; } udm_free_res($mResult); udm_free_agent($mnogo); ?> -- http://www.php.net/manual/en/function.udm-find.php http://master.php.net/manage/user-notes.php?action=edit+27890 http://master.php.net/manage/user-notes.php?action=delete+27890 http://master.php.net/manage/user-notes.php?action=reject+27890

« previous php.notes (#41227) next »