doumo6356 2013-08-02 18:57
浏览 114
已采纳

json数据库使用while循环轮播类型jquery json获取json的图像设置数据

i have an problem where can i get the jquery code for this? i have a database with image i want a jquery like this to output in my website

i will make a slider that will output like that

it will give me a slide that gives me that output i already have a database and php code that is working

australia

this is an australian government for missing person and our site is like this i want a jquery like this but i don't have the code of the original to do that

missingpersons australia is the link below i can't post here the link because it violate the rules of posting links :D

tried

jquery from search,div,table to output basic jquery don't know advance commands for jquery

tried this link the only problem is the while loop for the data

jquerydata

i edited the carousel the problem is how will i put it?

>     <?php
>     include_once('includes/dbConnect.php');
>     
>     
>     ?>
>     <?php
>     
>     $query=mysql_query("select * from persons order by rand()");
>     
>     while($test = mysql_fetch_array($query))  {
>     
>     }
>     
>     
>      ?>
>     [
>     {
>           "content": "<div class='slide_inner'><a class='photo_link' href='#'><img class='photo' src='banner_bike.jpg' alt='Bike'></a><a
> class='caption' href='#'>Sample Carousel Pic Goes Here And The Best
> Part is that...</a></div>",
>           "content_button": "<div class='thumb'><img src='f2_thumb.jpg' alt='bike is nice'></div><p>Agile Carousel Place
> Holder</p>"
>     },
>     {
>           "content": "<div class='slide_inner'><a class='photo_link' href='#'><img class='photo' src='banner_paint.jpg' alt='Paint'></a><a
> class='caption' href='#'>Sample Carousel Pic Goes Here And The Best
> Part is that...</a></div>",
>           "content_button": "<div class='thumb'><img src='f2_thumb.jpg' alt='bike is nice'></div><p>Agile Carousel Place
> Holder</p>"
>     },
>     {
>           "content": "<div class='slide_inner'><a class='photo_link' href='#'><img class='photo' src='banner_bike.jpg' alt='Bike'></a><a
> class='caption' href='#'>Sample Carousel Pic Goes Here And The Best
> Part is that...</a></div>",
>           "content_button": "<div class='thumb'><img src='f2_thumb.jpg' alt='bike is nice'></div><p>Agile Carousel Place
> Holder</p>"
>     },
>     {
>           "content": "<div class='slide_inner'><a class='photo_link' href='#'><img class='photo' src='banner_paint.jpg' alt='Paint'></a><a
> class='caption' href='#'>Sample Carousel Pic Goes Here And The Best
> Part is that...</a></div>",
>           "content_button": "<div class='thumb'><img src='f2_thumb.jpg' alt='bike is nice'></div><p>Agile Carousel Place
> Holder</p>"
>     },
>     {
>           "content": "<div class='slide_inner'><a class='photo_link' href='#'><img class='photo' src='banner_bike.jpg' alt='Bike'></a><a
> class='caption' href='#'>Sample Carousel Pic Goes Here And The Best
> Part is that...</a></div>",
>           "content_button": "<div class='thumb'><img src='f2_thumb.jpg' alt='bike is nice'></div><p>Agile Carousel Place
> Holder</p>"
>     },
>     {
>           "content": "<div class='slide_inner'><a class='photo_link' href='#'><img class='photo' src='banner_paint.jpg' alt='Paint'></a><a
> class='caption' href='#'>Sample Carousel Pic Goes Here And The Best
> Part is that...</a></div>",
>           "content_button": "<div class='thumb'><img src='f2_thumb.jpg' alt='bike is nice'></div><p>Agile Carousel Place
> Holder</p>"
>     },
>     {
>           "content": "<div class='slide_inner'><a class='photo_link' href='#'><img class='photo' src='Penguins.jpg' alt='Tunnel'></a><a
> class='caption' href='#'>Sample Carousel Pic Goes Here And The Best
> Part is that...</a></div>",
>           "content_button": "<div class='thumb'><img src='f2_thumb.jpg' alt='bike is nice'></div><p>Agile Carousel Place
> Holder</p>"
>     },
>     {
>           "content": "<div class='slide_inner'><a class='photo_link' href='#'><img class='photo' src='Penguins.jpg' alt='Tunnel'></a><a
> class='caption' href='#'>Sample Carousel Pic Goes Here And The Best
> Part is that...</a></div>",
>           "content_button": "<div class='thumb'><img src='f2_thumb.jpg' alt='bike is nice'></div><p>Agile Carousel Place
> Holder</p>"
>     }
>     
>     ]

here's the query of my image and name

>  $query=mysql_query("select * from persons  order by date desc LIMIT
> 0,10 ");
> 
> > <img height=200 width=200 src=' upload/". $test['Image'] ."'/> <a href
> > ='profile.php?PersonID=$id'> ".$test['LastName'].", ". $test['FirstName']." ". $test['MiddleName']."</a>

i'm using this while loop for my search and it calls correctly.

and here's the json code

> <script>
> 
>     $.getJSON("agile_carousel_data.php", function (data) {
> 
>         $("#multiple_slides_visible").agile_carousel({
>             carousel_data: data,
>             carousel_outer_height: 230,
>             carousel_height      : 200,
>             slide_height         : 200,
>             carousel_outer_width : 480,
>             slide_width          : 260,
>             number_slides_visible: 3,
>             transition_time      : 330,
>             control_set_1: "previous_button,next_button",
>             control_set_2: "group_numbered_buttons",
>             persistent_content: "<p class='persistent_content'>Agile Carousel Example: Multiple Slides Visible</p>"
>         });
> 
>     })
> 
>  </script>

this is the content of my $data in data.php

> `<?php include_once('includes/dbConnect.php'); $data = array(); while
> ($test = mysql_fetch_array($query)) { $data[]['content'] = "<div
> class='slide_inner'><a class='photo_link' href='#'><img class='photo'
> src='{$test['image']}' alt='Bike'></a><a class='caption'
> href='#'>Sample Carousel Pic Goes Here And The Best Part is
> that...</a></div>" $data[]['content_button'] = "<div
> class='thumb'><img src='{$test['thumb']}' alt='bike is
> nice'></div><p>Agile Carousel Place Holder</p>" } echo
> json_encode($data); ?> `

the code above won't give me anything i included my database connection but still nothing won't output anything here's the link again link for the original website

  • 写回答

1条回答 默认 最新

  • dongzhugao9929 2013-08-02 19:13
    关注

    Look for a jquery carousel plugin.
    http://vandelaydesign.com/blog/tools/jquery-carousel-plugins/ http://www.webdesigntunes.com/freebies/30-amazing-free-jquery-slider-and-carousel-plugins-of-2013/

    Edit: does this help?

    $data = array();
    $x = 0;
    while ($test = mysql_fetch_array($query)) {
        $data[$x]['content'] = "<div class='slide_inner'><a class='photo_link' href='#'><img class='photo' src='{$test['image']}' alt='Bike'></a><a class='caption' href='#'>Sample Carousel Pic Goes Here And The Best Part is that...</a></div>";
        $data[$x]['content_button'] = "<div class='thumb'><img src='{$test['thumb']}' alt='bike is nice'></div><p>Agile Carousel Place Holder</p>";
    $x++;
    }
    echo json_encode($data);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 根据以下文字信息,做EA模型图
  • ¥15 删除虚拟显示器驱动 删除所有 Xorg 配置文件 删除显示器缓存文件 重启系统 可是依旧无法退出虚拟显示器
  • ¥15 vscode程序一直报同样的错,如何解决?
  • ¥15 关于使用unity中遇到的问题
  • ¥15 开放世界如何写线性关卡的用例(类似原神)
  • ¥15 关于并联谐振电磁感应加热
  • ¥60 请查询全国几个煤炭大省近十年的煤炭铁路及公路的货物周转量
  • ¥15 请帮我看看我这道c语言题到底漏了哪种情况吧!
  • ¥60 关机时蓝屏并显示KMODE_EXCEPTION_NOT_HANDLED,怎么修?
  • ¥66 如何制作支付宝扫码跳转到发红包界面