SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Member
    Join Date
    Apr 2014
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to filter MySQL result set using AJAX?

    Hello Pullo, i see your javascript php and ajax demo form here and its awesome, and i used your code but after integrate your code my all result showing great but my checkbox checked all by default, but i want to try to show all result with no default checked and after i check on particular checkbox then mobiles brands will show.
    Thanks in advance
    Last edited by Pullo; Apr 8, 2014 at 10:34.

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,879
    Mentioned
    208 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    Welcome to the forums

    Can you post your code along with a dump of your db and some sample data?

  3. #3
    SitePoint Member
    Join Date
    Apr 2014
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your reply, my code is done and its working properly, i solve this from my end.
    But i have another question, my structure is showing in <tr><td> JSON_CODE </td></tr> means AJAX filter demo.png in this format but i want to try to show in this format Products.png but problem is that i don't know where and how i should put the HTML structure code, in PHP or AJAX code? I used the same code which is provide by you like http://www.sitepoint.com/forums/show...=1#post5608894 , sorry still I'm not using image code or it is not in your code but i want to show image in the given screenshot style, please help me what should i do.
    Thanks

  4. #4
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,879
    Mentioned
    208 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    Store the image path in the database and parse it as normal.

  5. #5
    SitePoint Member
    Join Date
    Apr 2014
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ya I can but in the given example, your html structure code in ajax which is
    ({ tbl_row += "<td>"+ v +"</td>";
    })
    tbl_body += "<tr>"+tbl_row+"</tr>";

    if I want to show this structure in php then how can i do, can you give me some example or in ajax how to put html structure, please guide me because ajax is new for me.
    Thanks In advance

  6. #6
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,879
    Mentioned
    208 Post(s)
    Tagged
    12 Thread(s)
    Quote Originally Posted by shubhamverma View Post
    if I want to show this structure in php then how can i do, can you give me some example or in ajax how to put html structure
    I'm sorry, I don't get what you mean by "show this structure in PHP".
    I had understood you to mean that you want to show images with your product descriptions.

    Are you asking how to realise the layout in the image you provided (as opposed to my example which used a table)?

  7. #7
    SitePoint Member
    Join Date
    Apr 2014
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry for my bad english and could not describe my real problem in standard way but yes you are right, i want to set a layout which is given in image, can you please describe it?
    Thanks

  8. #8
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,879
    Mentioned
    208 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    I don't have time to make a complete layout for you right now. Sorry
    Why don't you try and make it and post back here if you get stuck.

    You need only concentrate on the HTML and CSS (using some dummy text/images), then we can work out how to insert the product details in a second step.

  9. #9
    SitePoint Member
    Join Date
    Apr 2014
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay I'm trying.
    Thanks for your reply

  10. #10
    SitePoint Member
    Join Date
    Apr 2014
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello Pullo
    Sorry for again, I have another query, you are using PDO connectivity for connecting to DB, can we use simple mysql_connect function for connectivity to DB for this same script(filter MySQL result set using AJAX?)?

  11. #11
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,879
    Mentioned
    208 Post(s)
    Tagged
    12 Thread(s)
    Hey,

    Don't use PHP's deprecated mysql extension.
    Use mysqli (MySQL Improved) or PDO (PHP Data Objects) instead.

    http://www.sitepoint.com/forums/show...cedural-mysqli


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •