dongwo2222 2013-12-02 09:44
浏览 60
已采纳

Php和MySQL:根据用户点击的链接从数据库中检索数据

I've put a set of small images to function as links (around 50 more or less) on a page. In that same page I have a content place holder to display data from the database, and I have a table saved in phpmyadmin that has a set of fields filled with data.

What I want is when the user clicks on a certain image link, the data related to that image gets retrieved into the site. So I want the data to be retrieved to match the image clicked.

I know how to retrieve data from a database using the binding pannel in dreamweaver, and I know this has to do with filtering the data retrieved but I don't know how to do it.. How can I make this process work?

If it helps I'm also using Jquery CSS and javascript in this project.

The project looks like this:

http://i725.photobucket.com/albums/ww256/flower1991a/world_zps26b7083d.png

HTML code:

it doesnt show I took a screenshot of it:

http://i725.photobucket.com/albums/ww256/flower1991a/a_zpsa138aa52.png

jQuery code:

$(document).ready(function() { // begin Ready

//...................................................
// When the form changes
$('#mapForm').change(function() {

    var selectedContinent = $('#mapForm option:selected').val();
    if (selectedContinent == 'ALL'){
        $('a.dot').slideDown(1000);
    }else{
        $('a.dot[continent = "'+selectedContinent+'"]').slideDown(1000);
        $('a.dot[continent != "'+selectedContinent+'"]').slideUp(1000);
    }

});

//...................................................
// When a dot is clicked
$('a.dot').click(function(){

    $('a.dot').removeClass('selected');
    $(this).addClass('selected');

    var city = '.city_detail#' + $(this).attr('city');
    var htmlCode = $(city).html();

    $('.detail_container').fadeOut(500, function(){
        $('.detail_container .city_detail').html(htmlCode);
        $('.detail_container').fadeIn(500);
    });

});

// end Ready });

  • 写回答

1条回答 默认 最新

  • douchuitang0642 2013-12-02 09:47
    关注

    You need to create a PHP script which takes a REQUEST variable parameter depending on the image that has been clicked, and which returns the data for that image.

    You can then make a call to that PHP script via AJAX and populate whichever area of the page you want to with the data retrieved.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 酬劳2w元求合作写文章
  • ¥15 在现有系统基础上增加功能
  • ¥15 远程桌面文档内容复制粘贴,格式会变化
  • ¥15 关于#java#的问题:找一份能快速看完mooc视频的代码
  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图