由MySQL查询填充的表,当行选择时显示在右边的显示细节

时间:2015-01-28 07:56:48

标签: php jquery mysql ajax

这是一个新手和编程,知道一点点的PHP和CSS,但JQuery让我完全黑暗。

我试图按照THIS示例获取显示所选详细信息的表格,我可以显示该表格,但是当点击计划编号时,我没有得到回应。

列出表格的主页面,我希望RHS上显示的详细信息显示在下面的代码中:

listing.php

        <?php
            session_start();

            // Connect to host
            include 'config.php';
            $connection = new mysqli($DBhost, $DBuser, $DBpassword, $DBname);

            // Check connected to MySQL

            if ($connection->connect_error) {
               die('Connection Failed: [' . $connection->connect_error . ']');
            }

            $pageTitle = $_SESSION['rawtitle'];
            $listType = $_SESSION['listtype'];
            $criteriaDate = $_SESSION['criteriadate'];
            $listName = $_SESSION['listname'];
            $dbTable = $_SESSION['dbtable'];

            include 'header.php';

            $rawList = "SELECT * FROM testucm_schedules INNER JOIN testucm_holders ON testucm_schedules.SCHEDULE_HOLDER_ID=testucm_holders.HOLDER_ID WHERE SCHEDULE_DATERECEIVED >= '$criteriaDate'";
             $finalList = $connection->query($rawList);

            mysql_close($connection); // Closing Connection

        ?>

        <!DOCTYPE html>
        <html>
            <head>
             <link href="css/main.css" rel="stylesheet" type="text/css">
             <link href="css/listing.css" rel="stylesheet" type="text/css">

             <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

            </head>
            <body>
            <div id="mainContainer">

            <!-- Left Column -->
            <?php
               if ($_SESSION['listname'] == "Schedule") {
                  echo "<dt class'schedules'>";
               } else {
                  echo "<dt class='refunds'>";
               }
            ?>

            <div>
            <div class="listingMainTitle"><?php print $_SESSION['listname']; ?> Summary List</div>
            <div class="listingSubTitle">(Click On The <?php print   $_SESSION['listname']; ?> Number To See The <?php print $_SESSION['listname']; ?> Details</div>
            <div>
            <!-- Display The Schedule Summary List -->
            <?php
                echo "<div style='height: 550px; overflow-y: auto;'>";
                echo "<table class='sortable'>";
                echo "<thead>";
                echo "<tr>";
                echo "<th class='sorttable_numeric' style='width:130px;'>Schedule Number</th>
                   <th class='sorttable_alpha'>Holder</th>
                   <th class='sorttable_numeric'>Amount</th>";
                echo "</tr>";
                echo "</thead>";

                while($row = mysqli_fetch_array($finalList))
                {
                      echo "<tr>";
                      echo "<td class=listingTextCentre><href='detailsListing.php?did=$row[0]' target='content' class='listingDetails-link'><a class='green'> S".$row[0]."</a></td>
                            <td class='listingTextLeft'><a href='holderschedules.php?holderid=$row[1]' class='holder' id='holderName'>".$row[11]."</a></td>
                            <td class='listingTextRight'> $".number_format($row[4],2)."</td>";
                      echo "</tr>";
               }
               echo "</table>";
               echo "</div>";
        ?>

            </dt>

            <!-- Right Side Column -->
            <dd>
            <div id="listingDetails">
            </div>

            </body>
        </html>

在这里寻找其他答案,但一直无法找到任何答案。我可能会错过一些非常简单或做同样愚蠢的事情。

为了澄清,单击下面的代码时,没有任何内容可以填充<div id=listingDetails>区域中所需的信息。

echo "<td class=listingTextCentre><href='detailsListing.php?did=$row[0]' target='content' class='listingDetails-link'><a class='green'> S".$row[0]."</a></td>

在listing.php页面上的标记之前,我添加了,抱歉这在我的初始帖子中没有显示:

 <script>
 $('.listingDetails-link').click(
  function(){
   var durl = $(this).attr('ref');
   $('#listingDetails').load(durl)
 }
)
</script>

0 个答案:

没有答案