db_affected_rows() after SELECT query
Sweetchack - December 8, 2008 - 20:43
| Project: | API |
| Version: | HEAD |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
The pg_affected_rows() after a SELECT query always return 0, therefore the api_search_listing() does not works.
For find the mathes to the $search_text need another way
Maybe like this
<?php
$db_num_rows = db_result(db_query("SELECT COUNT(*) as num_rows FROM {api_documentation} WHERE branch_name = '%s' AND title = '%s'", $branch_name, $search_text));
if ($db_num_rows == 1) {
// Exact match.
$result = db_query_range("SELECT * FROM {api_documentation} WHERE branch_name = '%s' AND title = '%s'", $branch_name, $search_text, 0, 1);
}
else {
// Wildcard search.
$db_num_rows = db_result(db_query("SELECT COUNT(*) as num_rows FROM {api_documentation} WHERE branch_name = '%s' AND title LIKE '%%%s%%'", $branch_name, $search_text));
if ($db_num_rows == 1) {
$result = db_query_range("SELECT * FROM {api_documentation} WHERE branch_name = '%s' AND title LIKE '%%%s%%'", $branch_name, $search_text, 0, 1);
}
}
?>
#1
HEAD should be fixed for this now.
#2
Automatically closed -- issue fixed for two weeks with no activity.