Grow your CSS skills. Land your dream job.

Display MySql data into jquery slider !

  • # April 4, 2013 at 4:28 am

    I’ve been using an existing script to integrate with a jquery slider, I’ve tried lots of jquery sliders but Im always stuck at the same point & which is :

    that somehow I can’t tell the slider or script(which gets products from mysql) to continue displaying next products on the next slide.
    I’ve posted this issue on stackoverflow & other sites as well but useless.

    Now I want a suggestion or any easy way out of this issue. I just want to display 4 products at a time on one slide, then the next 4 products on the 2nd slide & so on…!

    these are the products I want to display using a jquery slider:
    http://www.tradeglobus.com
    (the products inside the “**Top Wholesale Suppliers**”)
    And if I increase the number of products from backend, it’ll display the slide numbers/bullets.
    its using jquery but its not animated.

    Please guys any help would be greatly appreciated, as Im so tired of working on same thing from about 2 weeks now :(

    Thanks in advance……!

    # April 4, 2013 at 4:47 am

    Can’t you write a query like

    Select * from Product_Table where SKU = 12345, 54321, 23425, 14522;

    And repeat it for each slide?

    # April 4, 2013 at 5:02 am

    How many products in total? If it’s not too much I’d just load them all into the slider, and use jQuery to show only 4 of them at a time.

    Else it gets more complicated, you’d need a php script that queries your database for 4 next (or previous) products and that script also needs to tell if there is a next (or previous) so you can show or hide those buttons. A query like tanners is possible if you know the SKUs (except it should be `where SKU in (12345, 54321, 23425, 14522)`), but if you don’t know the SKUs you can use `limit 4 offset ?` instead of `where`, where offset is a multiple of 4.

    Then you need to call that script using AJAX (I like jQuery’s `.post()` function, it’s easy), and display the results.

    # April 4, 2013 at 5:20 am

    what the hell ? I can’t submit code in my post :S
    its just keep executing it !

    well I was about to tell you that I have a PHP code which gets the products from MySQL into an existing slider, I tried to use it with many other jquery sliders, but its not displaying next 4 products on 2nd/3rd/4th slides, its just repeating the queries & displaying first 4 products on every slide.

    is there any way to show you this php code ?

    # April 4, 2013 at 5:22 am

    Try https://gist.github.com/

    # April 4, 2013 at 5:36 am

    Thanks Croco,

    here’s the php code at github:
    https://gist.github.com/anonymous/5309080

    check it & plz guide me how can I integrate this with any jquery slider.
    & this line controls the number of products to be displayed:

    $Query = clsMembers::getSupplierByLimit(16, 0);

    # April 4, 2013 at 9:56 pm

    Add a loop counter and use the magical Modulo function to display the results in blocks of four,

    http://php.net/manual/en/internals2.opcodes.mod.php

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".