Answer the question
In order to leave comments, you need to log in
Displaying search results from the index or from the database?
I search the site using sphinx, search the index with all the products, then pull the information from the index into a two-dimensional array as follows:
public function search_query($sql){
$result = $this->query($sql);
while ($row = mysqli_fetch_assoc($result)) {
$search_array[] = $row;
}
return $search_array;
}
for( $i = 0; $i < count($search_array); $i++){ echo $search_array[$i]['id']; }
Answer the question
In order to leave comments, you need to log in
The only foreach will be both faster and looks somehow better. And so ... one query to the database is better than hundreds.
What is the problem with pagination, you have an index, the easiest way to check
$page = 20;
if ($i%$page == 0) {
Новая страница
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question