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.

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

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?