Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Help to join search results

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
terra
Smarty Rookie


Joined: 27 Jul 2011
Posts: 26

PostPosted: Fri Mar 27, 2015 11:05 am    Post subject: Help to join search results Reply with quote

Code:


Hello,
 
So I have the code below that makes searching the web (xml) and am now implementing the search in the database. I want to unify the xml results with database results.
The results of web shows no problems, but the database items only 1 page, no matter how much I put in limiter
 
$Records = '10';
 
Quote
 
here the web result (xml)
 
$ Products = $ json_reply [products];
$ Link = "/geetagem/search.php?keyword=$q&location=$l&co=$co";
 
$ Pagination = new CSSPagination ($ json_reply ['totalResults'], $ limit, $ link); // Create instance object
 
if (isset ($ _ REQUEST ['page'])) {
    $ Pagination-> setPage ($ _ REQUEST ['page']); // Do not change it
} Else {
    $ Pagination-> setPage (1);
 } 
 
$ Pagination = $ pagination-> showPage ();
 
I want to join the results, BD + WEB, the paging up 
 
 
 
here the search in BD
Quote
$ Page = (isset ($ _ GET ['page']))? $ _GET ['Page']: 1;
 
    // Selects all table items
        $ Cmd = "select * from tblprod";
        $ Products = mysql_query ($ cmd);
   
    // Counts the total of items
        Total $ = mysql_num_rows ($ products);
   
    // Sets the number of items per page, in this case, items 2
       $ Records = 1;
   
    // Calculate the number of pages rounding the result up
        $ NumPaginas = ceil ($ Total / $ records);
   
    // Variable to calculate the start of view based on the current page
        $ Start = ($ records * $ page) - $ records;
 
    // Select items per page
        $ Cmd = "select * from tbljobs limit $ start, $ records";
        $ Products = mysql_query ($ cmd);
        Total $ = mysql_num_rows ($ products);
 
    // Display the selected products
$ Products2 = array ();
        while ($ row = mysql_fetch_array ($ products)) {
            $ Products2 [$ i] = $ row;
        }
// Display pagination
       // For ($ i = 1; $ i <$ numPaginas + 1; $ i ++) {
             // Echo "<a href='search.php?page=$i'>" $ i "</a>"..;
       //}
 
$ Smarty-> assign (products', $ products);
$ Smarty-> assign ('pagination', $ pagination);
$ Smarty-> assign ('products2', $ products2);
$ Smarty-> assign ('pagination2', $ pagination2);
$ Smarty-> assign ('lang', $ lang);
$ Smarty-> display ('search.html');
 
 if I put the limiter $ records = 10, shows only the last item of BD and if I put $ records = 1 shows one record per page.
 
That's it.
 
I appreciate any help, have long since'm puzzling over this. I give up, I'll be back to try, give up again, I again try ...
 
Toninho

Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP