สอบถามการดึงข้อมูลไปแสดงอีกหน้า

สำหรับผู้ที่ เริ่มต้น Programming - PHP มีอะไร แนะนำ หรือข้อสงสัยต้องบอร์ด นี้ คนที่มีความรู้ แบ่งปันคนอื่นบ้างนะ ปัญหาการเขียนโปรแกรม แบบ OOP Session Cookies php network

Moderator: mindphp, ผู้ดูแลกระดาน

suhaila
PHP Super Member
PHP Super Member
โพสต์: 480
ลงทะเบียนเมื่อ: 19/04/2021 9:51 am

สอบถามการดึงข้อมูลไปแสดงอีกหน้า

โพสต์ที่ยังไม่ได้อ่าน โดย suhaila »

ต้องการดึงข้อมูลไปแสดงอีกหน้า
Programming - PHP-1.png
Programming - PHP-1.png (38.34 KiB) Viewed 1092 times
ในหน้า index.php ตอนคลิกที่ข้อมูลที่จะให้แสดงในหน้า show.php ของข้อมูลแถวนั้น
Programming - PHP-1.png
Programming - PHP-1.png (59.54 KiB) Viewed 1092 times

พอมาหน้า show.php ของช่องชื่อผู้ใช้ขึ้นเออเรอแบบนี้
<br /><b>Notice</b>: Array to string conversion in <b>C:\xampp\htdocs\Joomla3.9.26\tools\tools_recheck_province\show.php</b> on line <b>111</b><br />Array
ในช่องไปรษณีย์ข้อมูลก็ขึ้นเออเรอแบบนี้
<br /><b>Notice</b>: Array to string conversion in <b>C:\xampp\htdocs\Joomla3.9.26\tools\tools_recheck_province\show.php</b> on line <b>117</b><br />Array

และข้อมูลที่แสดงในช่องสี่เหลี่ยมนั้นจะไม่ตรงกับไอดีที่คลิกมา มันจะแสดงข้อมูลข้อแรกที่อยู่ในตารางเลย
Programming - PHP-1.png
Programming - PHP-1.png (90.73 KiB) Viewed 1092 times
โค้ดหน้า index

โค้ด: เลือกทั้งหมด

<?php
 date_default_timezone_set("Asia/Bangkok");
 $date = time();
 $time = (date("Y-m-d H:i:s", $date)) . "<br>";
 $ip = $_SERVER["REMOTE_ADDR"];
date_default_timezone_set("Asia/Bangkok");
require_once'conn.php';
include '../config.php';

?>
<link rel="stylesheet" href="../css/color.css">
<!-- <link rel="stylesheet" href="../tools_keyword_youtube/cssyou.css"> -->

<meta property="og:url"           content="<?php echo ((array_key_exists('HTTPS', $_SERVER) && $_SERVER["HTTPS"] == "on") ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?>"/>
<meta property="og:type"          content="website" />
<meta property="og:title"         content="<?php echo $lang_unitcomdate; ?>"/>
<meta property="og:description"   content="<?php echo $lang_unitcomdate; ?>"/>
<meta property="og:image"         content="https://www.mindphp.com/images/content/Tool/tools_search_keyword_youtube.png"/>
<meta property="og:image:alt"     content="<?php echo $lang_programconver; ?>"/>
<meta name="keywords"             content="<?php echo $lang_progrcalculatetaxkk; ?>"/>

<title><?php echo $lang_programconvertunit; ?></title>
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "SoftwareApplication",
    "name": "keyword youtube",
    "image": "https://www.mindphp.com/images/info/mindphp-logo-v40.png",
    "description": "โปรแกรมสำหรับค้นหา keyword ของ youtube",
    "operatingSystem": "Windows 7",
    "applicationCategory": "http://schema.org/GameApplication",
    "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4.7",
    "ratingCount": "23214"
    }
    }
</script>

<script src="https://www.google.com/recaptcha/api.js" asyncdefer></script>

<?php
include '../header.php';
include '../PHP-Pagination-master/Pagination.class.php';

ini_set('display_errors', 1);
error_reporting(~0);

$POSTCODE = null;

if (isset($_POST["POSTCODE"])) {
    $POSTCODE = $_POST["POSTCODE"];
}



$page = 1;
if (isset($_GET['page'])) {
    $page = $_GET['page'];
}
$row = 10;

$total_data = "SELECT COUNT(id) FROM $table_con";
$result_1 = mysqli_query($conn, $total_data);
$total = mysqli_fetch_row($result_1);
$total_data = $total[0];
$start = ($page - 1) * $row;
$Pagination = new Pagination($page, $total_data);
$Pagination->parse();

$sql = "SELECT * FROM $table_con WHERE name LIKE '%" . $POSTCODE . "%'  ORDER BY id DESC Limit $start,$row";


$result = mysqli_query($conn, $sql);
?>



<div class="container">
    <div class="col-md-12">
        <div class="row">
            <div class="btn-group btn-breadcrumb">
                <a  class="btn btn-default"><?php echo $lang_youarehere; ?> :</a>
                <a href="https://www.mindphp.com/online-tools/mindphp-tools.html" class="btn btn-default"><?php echo $lang_tools; ?></a>
                <a href="index.php?lang=<?php echo $lang; ?>" class="btn btn-primary"><?php echo $lang_programconvertunit; ?></a>
            </div>
        </div><br>
    </div>

    <div class="col-md-4">
        <?php //include 'menu_sidebar.php'; ?>
    </div>

    <div class=" col-md-8">
        <div class="col-md-12">
            <div class="panel panel-primary">
                <div class="panel-heading"><?php echo $lang_programconvertunit; ?></div>
                <div class="panel-body">
                    <form class="form-horizontal" name="frm" method="post" action="">
                        <br>
                        <div class="col-md-12">
                            <div class="form-group">
                                <label for="inputname" class="col-sm-3 control-label"><?php echo $lang_name; ?> : </label>
                                <div class="col-sm-9">
                                    <input required type="text" class="form-control" id="inputEmail3" placeholder="<?php echo $lang_pleaseyourname ?>" name="user_name">
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="inputarea-value" class="col-sm-3 control-label"><?php echo $lang_unit; ?> :</label>
                                <div class="col-sm-9">
                                <input required type="" class="form-control" id="inputPassword3" placeholder="<?php echo $lang_enternumunit; ?>" name="valuenum">       </div>
                            </div>

                                <div class="col-md-12">
                                    <div align="center" class="g-recaptcha" required data-sitekey="<?php echo $keyrecaptcha; ?>"></div><br>
                                </div>
                                <br>
                                <div  class="col-md-12">
                                    <center>
                                        <input class=" btn btn-success" type="submit" name="submit" value="<?php echo $lang_calculate; ?>" />
                                        <input class="btn btn-danger" type="reset" name="reset" value="<?php echo $lang_cleaar; ?>"/>
                                    </center>
                                </div>

                        </div>
       
                        <div class="col-md-12">
                            <?php
                            if (isset($_POST['g-recaptcha-response'])) {
                                $keyrecaptcha = $_POST['g-recaptcha-response'];
                                $response = json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . $secretkeyrecaptcha . "&response=" . $keyrecaptcha . "&remoteip=" . $_SERVER['REMOTE_ADDR']), true);
                                if (!$keyrecaptcha) {
                                    $missinginputsecret = "คลิกทำเครื่องหมายถูกตรวจสอบว่าคุณไม่ใช้โปรแกรมอัตโนมัติ";
                                    ?>
                                     <br><div align="center" class="unnit-color"><b><?php print_r($missinginputsecret) ?></b></div>
                                     <?php
                                }
                            }


                                if (isset($_POST['submit'])) {
                                    $submit1 = @$_POST['submit1'];
                                    $name = $_POST['user_name'];
                                    $value = $_POST['valuenum'];//เราต้องใส่ลิงยูทูปที่จะเปลี่ยนเป็นรหัสไปร
                                    // $key = '';
                                    $sql = "SELECT * FROM mzc_mdistrict 
                                    INNER JOIN mzc_mprovince ON mzc_mprovince.PROVINCE_ID = mzc_mdistrict.PROVINCE_ID 
                                    INNER JOIN mzc_mamphur on mzc_mamphur.AMPHUR_ID = mzc_mdistrict.AMPHUR_ID 
                                    WHERE mzc_mamphur.POSTCODE =$value";
                                     $result2 = mysqli_query($conn, $sql);
                                    while (@$fetch1 = mysqli_fetch_assoc($result2)) {
                                        $district = $fetch1['DISTRICT_NAME'];
                                        $district1 = $fetch1['DISTRICT_ID'];
                                        $province2 =$fetch1['PROVINCE_NAME'];
                                        $province4 =$fetch1['PROVINCE_ID']; 
                                        $amphor =$fetch1['AMPHUR_NAME'];
                                        $amphor1 =$fetch1['AMPHUR_ID'];
                                        
                                    }
                                    $sql3 = "INSERT INTO `$table_con`( `user_name`, `PROVINCE_ID`, `DISTRICT_ID`, `AMPHUR_ID`, `create_date`, `ip`) 
                                    VALUES ('$name','$province4','$district1','$amphor1','$time','$ip')";
                                     $result2 = mysqli_query($conn, $sql3);


                                     
                                    // $sql = "SELECT * FROM `mzc_mdistrict`WHERE `DISTRICT_CODE` = $value ";
                                    // $result2 = mysqli_query($conn, $sql);
                                    // while (@$fetch1 = mysqli_fetch_assoc($result2)) {
                    
                                    // $district =    $fetch1['DISTRICT_NAME'];
                                    // $provinceId =    $fetch1['PROVINCE_ID'];  
                                    // $amphorid =  $fetch1['AMPHUR_ID'];
                                    // }
                                    // $sql1 = "SELECT * FROM `mzc_mprovince` WHERE PROVINCE_ID = $provinceId";
                                    // $result3 = mysqli_query($conn, $sql1);
                                    // while (@$fetch2 = mysqli_fetch_assoc($result3)) {
                                    //         $province2 = $fetch2['PROVINCE_NAME'];
                                    //     }
                                
                                // date_default_timezone_set("Asia/Bangkok");
                                // $date = time();
                                // $time = (date("Y-m-d H:i:s", $date)) . "<br>";
                                // $ip = $_SERVER["REMOTE_ADDR"];
                                
                                ?>

                                <table class="table">
                                    <tbody>
                                        <tr class="active">
                                            <td align="right" width="50%">
                                                <?php echo $lang_name . " : "; ?>
                                            </td>
                                            <td>
                                                <?php echo $name; ?>
                                            </td>
                                        </tr>
                                        <tr class="warning">
                                            <td align="right" width="50%">
                                                <?php echo $lang_showunitsthat . "  :"; ?>
                                            </td>
                                            <td>
                                                <?php echo $value . "   "; ?>
                                            </td>
                                        </tr>  

                                        <tr class="active">
                                            <td align="right" width="50%">
                                               <?php  echo $lang_place . "  :"; ?>
                                            </td>
                                            <td> 
                                                <?php echo $district . "   "; ?>
                                            </td>
                                        </tr>

                                        <tr class="warning">
                                            <td align="right" width="50%">
                                                <?php  echo $lang_province . "  :"; ?>
                                            </td>
                                            <td>
                                                <?php  echo $province2; ?>
                                            </td>
                                        </tr>

                                        <tr class="active">
                                            <td align="right" width="50%">
                                                <?php  echo $lang_district. "  :"; ?>
                                            </td>
                                            <td>
                                                <?php echo $amphor ?>
                                            </td>
                                        </tr>

                                              <!-- <img border="0" src="<?php //echo $thumbnail ?>">
                                            </td>
                                        </tr> -->
                                        
                                        <tr class="active">
                                            <td align="right" width="50%">
                                                <?php echo $lang_recordtime . " :" ?>
                                            </td>
                                            <td>
                                                <?php echo date("Y-m-d  H:i:s", time()); ?>
                                            </td>
                                        </tr>

                                        <tr class="warning">
                                            <td align="right" width="50%">
                                                <?php echo $lang_ipaddress . "  : "; ?>
                                            </td>
                                            <td>
                                                <?php echo $ip. "   "; ?>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>

                                <center><a href="index.php?lang=<?php echo $lang; ?>" class="btn btn-info"><?php echo $lang_resets;?></a></center>

                                <?php


                                // if ($submit1) {
                                //     header("location: ../convert-unit/show.php?id=$last_id");
                                //     exit(0);
                                // }
                            }
                            ?>
                        </div>
                    </form>
                    <div align="right"> <?php echo $lang_vercheckunit; ?> <?php echo $verconvertunit; ?></div>
                </div>
            </div>
        </div>
        <div class="col-md-12">
            <?php// include 'tags.php'; ?>
        </div>

        <div class="well2">
            <br>
            <ul>
                <b><?php  echo $lang_unitconversion;?></b>
                <li><?php echo $lang_enteryourname;?> <b><?php echo $lang_name;?></b></li>
                <li><?php echo $lang_selecttypeofunit;?>  <b><?php echo $lang_selectunit;?>  </b></li>
                <li><?php echo $lang_pressbutton;?> <b><?php echo $lang_calculate;?></b> <?php echo $lang_seeresults;?></li>
            </ul>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12 table-responsive" align="center">
            <h3 align="center"><?php echo $lang_recentinformation;?></h3>
            <table class="table table-striped">
                <thead class="bg-primary" align="bottom">
                    <tr>
                        <th class="text-center" width="2%"><b><?php echo $lang_no; ?></b></th>
                        <th class="text-center" width="5%">  <?php echo $lang_name?>  </th>
                        <th class="text-center" width="15%">  <?php echo $lang_unit   //แสดงรหัสไปรษณีย์ ?>  </th> 
                        <th class="text-center" width="20%">  <?php echo $lang_province//ตัว keyword ของยูทูปเปลี่ยนเป็นจังหวัด?>  </th>
                        <th class="text-center" width="5%">  <?php echo $lang_place //ส่วนนี้แสดงตำบล?>  </th>
                        <th class="text-center" width="5%">  <?php echo $lang_district //ส่วนนี้จะให้แสดงเป็นอำเภอ?>  </th> 
                        <th class="text-center" width="5%">  <?php echo $lang_savewhen?>  </th>
                        <th class="text-center" width="5%">  <?php echo $lang_ipaddress;?>  </th>
                        <!-- <th>  Edit time-date  </th> -->
                        <th class="text-center" width="5%"> <?php echo $lang_showinformation?> </th>
                        <th class="text-center" width="5%"> <?php ?> </th>
                    </tr>
                </thead>

                <?php
                
                $sql = "SELECT * FROM $table_con 
                INNER JOIN $province_con ON $province_con.PROVINCE_ID = $table_con.PROVINCE_ID 
                INNER JOIN $mdistrict_con on $mdistrict_con.DISTRICT_ID = $table_con.DISTRICT_ID 
                INNER JOIN $mamphur_con on $mamphur_con.AMPHUR_ID = $table_con.AMPHUR_ID 
                WHERE $table_con.id ORDER BY id desc Limit $start,$row";
                $result2 = mysqli_query($conn, $sql);
                     while ($fetch = mysqli_fetch_assoc($result2)) {


            // $sql = "SELECT * FROM $table_con ORDER BY id desc Limit $start,$row";
            //          $result2 = mysqli_query($conn, $sql);
            //      while ($fetch = mysqli_fetch_assoc($result2)) {
                     ?>

                     <tr>
                         <td class="text-center">  <?php echo $fetch['id']; ?></td>      <!-- ลำดับ-->
                         <td class="text-center">  <?php echo $fetch['user_name']; ?></td>    <!-- ชื่อ-->
                         <td class="text-center">  <?php echo $fetch['POSTCODE']; ?></td>     <!-- url-->
                         <td class="text-center">  <?php echo $fetch['PROVINCE_NAME']; ?></td>     <!-- url-->
                         <td class="text-center">  <?php echo $fetch['DISTRICT_NAME']; ?></td> <!-- keyword-->
                         <td class="text-center">  <?php echo $fetch['AMPHUR_NAME']; ?></td>     <!-- url-->
                        
                         <td class="textcenter">  <?php
                             if ($fetch['create_date']) {
                                 echo  $fetch['create_date'];
                           }
                            ?></td>
                         <td class="text-center">  <?php include 'ip.php'; ?></td>
                        
                         <td>
                            <a href="show.php?id=<?php echo $fetch['id']; ?>&lang=<?php echo $lang; ?>">
                                <i class="glyphicon glyphicon-new-window"></i>
                            </a>
                        </td>

                        
                    <td><a class="btn btn-warning" href="edit.php?id=<?php echo $fetch['id']; ?>">แก้ไข</a></td>

                     </tr>
                     <?php
            }
                ?>
            </table>
            <div class="row">
                    <div class="col-md-12">
                        <div class="text-center">
                            <nav aria-label="Page navigation">
                                <?php
                                echo $Pagination->parse();
                                ?>
                            </nav>

                        </div>
                    </div>
                </div>
            <a href="list.php?lang=<?php echo $lang; ?>"  class="btn btn-primary"><?php echo $lang_moreinformation; ?></a>
        </div>
    </div>
</div>
<?php include '../footer.php'; ?>
โค้ดหน้า show

โค้ด: เลือกทั้งหมด

<?php
date_default_timezone_set("Asia/Bangkok");
$date = time();
$time = (date("Y-m-d H:i:s", $date)) . "<br>";
$ip = $_SERVER["REMOTE_ADDR"];
// date_default_timezone_set("Asia/Bangkok");
require_once'conn.php';
include '../head_html.php';
include '../PHP-Pagination-master/Pagination.class.php';
?>

<meta property="og:url"           content="<?php echo ((array_key_exists('HTTPS', $_SERVER) && $_SERVER["HTTPS"] == "on") ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?>" />
<meta property="og:type"          content="website" />
<meta property="og:title"         content="<?php echo $lang_des_show; ?>" />
<meta property="og:description"   content="<?php echo $lang_des_show  ; ?>" />
<meta property="og:image"         content="https://www.mindphp.com/images/content/Tool/tools_search_keyword_youtube.png"/>
<meta property="og:image:alt"     content="<?php echo $lang_programconver; ?>" />
<meta name="keywords"             content="<?php echo $lang_des_showk; ?>" />

<title><?php echo $lang_programconvertunit;?></title>
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "SoftwareApplication",
    "name": "keyword youtube",
    "image": "https://www.mindphp.com/images/info/mindphp-logo-v40.png",
    "description": "โปรแกรมสำหรับค้นหา keyword ของ youtube",
    "operatingSystem": "Windows 7",
    "applicationCategory": "http://schema.org/GameApplication",
    "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4.7",
    "ratingCount": "23214"
    },
    "offers": {
    "@type": "Offer",
    "price": "1.00",
    "priceCurrency": "USD"
    }
    }
</script>

<?php
ob_start();
$page = 1;
if (isset($_GET['page'])) {
    $page = $_GET['page'];
}
$row = 10;

$total_data = "SELECT COUNT(id) FROM $table_con";
$result_1 = mysqli_query($conn, $total_data);
$total = mysqli_fetch_row($result_1);
$total_data = $total[0];
$start = ($page - 1) * $row;
$Pagination = new Pagination($page, $total_data);
$Pagination->parse();

// $data = array();
// if (isset($_GET['id']) ) {
//                $sql = "SELECT * FROM $table_con WHERE id = " . $_GET['id'];
//                $result = mysqli_query($conn, $sql);
//                $data = mysqli_fetch_assoc($result);
// }
// $sql = "SELECT * FROM $table_con  ORDER BY id DESC Limit 10";
// $result = mysqli_query($conn, $sql);

  include '../header.php';
?>

<div class="container">
    <div class="row">
        <div class="col-md-12">
            <div class="col-md-12">
                <div class="row">
                    <div class="col-md-12">
                        <div class="btn-group btn-breadcrumb">
                            <a  class="btn btn-default"><?php echo $lang_youarehere; ?> :</a>
                            <a href="https://www.mindphp.com/online-tools/mindphp-tools.html" class="btn btn-default"><?php echo $lang_tools; ?></a>
                            <a href="index.php?lang=<?php echo $lang; ?>" class="btn btn-default"><?php echo $lang_programconvertunit; ?></a>
                            <a href="list.php?lang=<?php echo $lang; ?>" class="btn btn-default"><?php echo $lang_datatable; ?></a>
                            <a href="#" class="btn btn-primary">
                                <?php
                                // $dataname = (isset($data['user_name'])) ? $data['user_name'] : '';
                                
                                
                                ?>
                            </a>
            </div>
        </div><br>
    </div>
    <div class="col-md-4">
        <?php //include 'menu_sidebar.php'; ?>
    </div>

    <div class=" col-md-8">
        <div class="col-md-12">
            <?php //include 'script_facebook.php'; ?>
        </div>
        <div class="col-md-12">
            <div class="panel panel-primary">
                <div class="panel-heading"><?php echo $lang_programconvertunit; ?></div>
                <div class="panel-body">
                    <form class="form-horizontal" name="frm" method="post" action="">
                        <br>
                        <div class="col-md-12">
                                        <div class="col-md-10">
                                            <div class="form-group">
                                                <label for="inputname" class="col-sm-4 control-label"><?php echo $lang_name;?> : </label>
                                                <div class="col-sm-8">
                                                    <input required type="text" class="form-control" id="inputEmail3" placeholder="username" name="name" value="<?php echo $name ?>">
                                                </div>
                                                
                                            </div>
                                            <div class="form-group">
                                                <label for="inputname" class="col-sm-4 control-label"><?php echo $lang_showunitsthat;?> : </label>
                                                <div class="col-sm-8">
                                                    <input required type="" class="form-control" id="inputPassword3" placeholder=""  name="valuenum" value="<?php echo $value ?>">
                                                </div>
                                            </div>


                                        </div>

                                    </div>
                                    <div class="col-md-12">
                                        <div class="col-md-6">

                                        </div>
                                        <div class="col-md-6">
                                            <input class=" btn btn-success  " type="submit" name="submit" value="<?php echo $lang_calculate;?>" />
                                            <a class="btn btn-info btn-large" href= "index.php?lang=<?php echo $lang; ?>"><?php echo $lang_homes;?></a>
                                        </div>
                                        <?php
                                      if (isset($_POST['submit'])){
                                            $submit1 = @$_POST['submit1'];
                                            $name = $_POST['name'];
                                            $value = $_POST['valuenum'];
                                           // $key = '';

                                        //    $sql = "SELECT * FROM mzc_mdistrict 
                                        //    INNER JOIN mzc_mprovince ON mzc_mprovince.PROVINCE_ID = mzc_mdistrict.PROVINCE_ID 
                                        //    INNER JOIN mzc_mamphur on mzc_mamphur.AMPHUR_ID = mzc_mdistrict.AMPHUR_ID 
                                        //    WHERE mzc_mamphur.POSTCODE =$value";




                                          }

                                        ?>

                                    </tbody>
                                </table>
                                <table  id="table-listtax" class="table table-striped">
                                <?php
                                $sql = "SELECT * FROM $table_con 
                                        INNER JOIN mzc_mprovince ON mzc_mprovince.PROVINCE_ID = $table_con.PROVINCE_ID 
                                        INNER JOIN mzc_mdistrict on mzc_mdistrict.DISTRICT_ID = $table_con.DISTRICT_ID 
                                        INNER JOIN mzc_mamphur on mzc_mamphur.AMPHUR_ID = $table_con.AMPHUR_ID 
                                        WHERE $table_con.id ";
                                    $result = mysqli_query($conn, $sql);

                                if ($fetch = mysqli_fetch_array($result)) {
                                               ?>

                                                       <tbody>
                                                       <tr class="active">
                                                       <td width="25%">
                                                       <b><?php echo $lang_no; ?></b
                                                   </td>
                                                   <td>
                                                       <p><?php echo $fetch['id']; ?></p>
                                                   </td>
                                                   </tr>
                                                   <tr class="info">
                                                       <td>
                                                           <b><?php echo $lang_name;?></b>
                                                       </td>
                                                       <p><td>  <?php echo $fetch['user_name']; ?></td></p>

                                                   </tr>

                                                   <tr class="active">
                                                       <td>
                                                           <b><?php echo $lang_unit;?></b>
                                                       </td>
                                                       <td>
                                                           <p><?php echo $fetch['POSTCODE']; ?></p>
                                                       </td>
                                                   </tr>
                                                   <tr class="info">
                                                       <td>
                                                           <p><b><?php echo $lang_place;?></b></p>
                                                       </td>
                                                       <td>

                                                         <p><?php echo $fetch['AMPHUR_NAME']; ?></p>
                                                       </td>
                                                   </tr>
                                                   <tr class="active">
                                                       <td>
                                                           <p><b><?php echo $lang_province;?></b></p>
                                                       </td>
                                                       <td>
                                                           <p><?php echo $fetch['PROVINCE_NAME']; ?></p>
                                                       </td>
                                                   </tr>

                                                   <tr class="info">
                                                       <td>
                                                           <p><b><?php echo $lang_district;?></b></p>
                                                       </td>
                                                       <td>
                                                           <p><?php echo $fetch['DISTRICT_NAME']?></p>
                                                       </td>
                                                   </tr>

                                                   <tr class="info">
                                                       <td>
                                                           <p><b><?php echo $lang_savewhen;?></b></p>
                                                       </td>
                                                       <td>
                                                           <?php
                                                            if ($fetch['create_date']) {
                                                             echo  $fetch['create_date'];
                                                           }
                                                           ?>
                                                       </td>
                                                   </tr>
                                                   <tr class="active">
                                                       <td>
                                                           <p><b><?php echo $lang_ipaddress;?></b></p>
                                                       </td>
                                                       <td>
                                                           <?php
                                                            $aeip = $fetch['ip'];
                                                            echo preg_replace('/\.\d{1,3}\z/', '.***', $aeip);

                                                           ?>
                                                       </td>
                                                   </tr>
                                                   <p  class=pull-right>
                                                       <a class="btn btn-primary btn-large" href= "list.php?lang=<?php echo $lang; ?>"><?php echo $lang_allinfomation;?></a>
                                                   </p>
                                                   </tbody>
                                                   <?php
                                    }
                                    ?>
                                </table>



                        </div>
                    </form>
                    <div align="right"> <?php echo $lang_vercheckunit; ?> <?php echo $verconvertunit; ?></div>
                </div>
            </div>
        </div>
        <div class="col-md-12">
            <?php// include 'tags.php'; ?>
        </div>

        <div class="well2">
            <br>
            <ul>
                <b><?php echo $lang_unitconversion;?></b>
                <li><?php echo $lang_enteryourname;?> <b><?php echo $lang_name;?></b></li>
                <li><?php echo $lang_selecttypeofunit;?>  <b><?php echo $lang_selectunit;?>  </b></li>
                <li><?php echo $lang_pressbutton;?> <b><?php echo $lang_calculate;?></b> <?php echo $lang_seeresults;?></li>
            </ul>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12 table-responsive" align="center">
            <h3 align="center"><?php echo $lang_recentinformation;?></h3>
            <table class="table table-striped">
                <thead class="bg-primary" align="bottom">
                    <tr>
                        <th class="text-center" width="2%"><b><?php echo $lang_no; ?></b></th>
                        <th class="text-center" width="5%">  <?php echo $lang_name?>  </th>
                        <th class="text-center" width="15%">  <?php echo $lang_unit?>  </th>
                        <th class="text-center" width="20%">  <?php echo $lang_province//ตัว keyword ของยูทูปเปลี่ยนเป็นจังหวัด?>  </th>
                        <th class="text-center" width="5%">  <?php echo $lang_district //ส่วนนี้จะให้แสดงเป็นอำเภอ?>  </th> 
                        <th class="text-center" width="5%">  <?php echo $lang_place //ส่วนนี้แสดงตำบล?>  </th>
                        <th class="text-center" width="5%">  <?php echo $lang_savewhen?>  </th>
                        <th class="text-center" width="5%">  <?php echo $lang_ipaddress;?>  </th>
                        <!-- <th>  Edit time-date  </th> -->
                        <th class="text-center" width="5%"> <?php echo $lang_showinformation?> </th>
                    </tr>
                </thead>

                <?php
                 $sql2 = "SELECT * FROM $table_con 
                 INNER JOIN mzc_mprovince ON mzc_mprovince.PROVINCE_ID = $table_con.PROVINCE_ID 
                 INNER JOIN mzc_mdistrict on mzc_mdistrict.DISTRICT_ID = $table_con.DISTRICT_ID 
                 INNER JOIN mzc_mamphur on mzc_mamphur.AMPHUR_ID = $table_con.AMPHUR_ID 
                 WHERE $table_con.id ORDER BY id desc Limit $start,$row";
                 $result2 = mysqli_query($conn, $sql2);
                      while ($fetch = mysqli_fetch_assoc($result2)) {


            //    $sql2 = "SELECT * FROM $table_con ORDER BY id desc Limit $start,$row";
            //         $result2 = mysqli_query($conn, $sql2);
            //     while ($fetch = mysqli_fetch_assoc($result2)) {
                    ?>

                    <tr>
                        <td class="text-center">  <?php echo $fetch['id']; ?></td>      
                         <td class="text-center">  <?php echo $fetch['user_name']; ?></td>    
                         <td class="text-center">  <?php echo $fetch['POSTCODE']; ?></td>     
                         <td class="text-center">  <?php echo $fetch['PROVINCE_NAME']; ?></td>     
                         <td class="text-center">  <?php echo $fetch['DISTRICT_NAME']; ?></td> 
                         <td class="text-center">  <?php echo $fetch['AMPHUR_NAME']; ?></td> 
                        <td class="text-center">  <?php
                            if ($fetch['create_date']) {
                                echo  $fetch['create_date'];
                            }
                            ?></td>
                        <td class="text-center">  <?php include 'ip.php'; ?></td>
                        <td>
                    <center><a  class="glyphicon glyphicon-new-window" href="show.php?id= <?php echo $fetch['id']; ?>&lang=<?php echo $lang; ?> "></a></center>
                    </td>

                    </tr>
                    <?php
                }
                ?>
            </table>
            <div class="row">
                    <div class="col-md-12">
                        <div class="text-center">
                            <nav aria-label="Page navigation">
                                <?php
                                echo $Pagination->parse();
                                ?>
                            </nav>

                        </div>
                    </div>
                </div>
            <a href="list.php?lang=<?php echo $lang; ?>"  class="btn btn-primary"><?php echo $lang_moreinformation; ?></a>
        </div>
    </div>
</div>

<?php include '../footer.php'; ?>

อยากทราบว่ามันติดตรงไหนค่ะ
ภาพประจำตัวสมาชิก
tsukasaz
PHP VIP Members
PHP VIP Members
โพสต์: 21911
ลงทะเบียนเมื่อ: 18/04/2012 9:39 am

Re: สอบถามการดึงข้อมูลไปแสดงอีกหน้า

โพสต์ที่ยังไม่ได้อ่าน โดย tsukasaz »

หน้า show ต้องรับ id จากหน้า index มาดึงข้อมูลครับ


ดูในภาพด้านล่าง WHERE ไม่ครบหรือเปล่า
Programming - PHP-1.png
Programming - PHP-1.png (63.15 KiB) Viewed 1088 times
The last bug isn't fixed until the last user is dead. (Sidney Markowitz, 1995)
suhaila
PHP Super Member
PHP Super Member
โพสต์: 480
ลงทะเบียนเมื่อ: 19/04/2021 9:51 am

Re: สอบถามการดึงข้อมูลไปแสดงอีกหน้า

โพสต์ที่ยังไม่ได้อ่าน โดย suhaila »

ได้แล้วค่ะ ที่ติดเพราะไม่ได้ใส่ตัวแปรรับค่าไอดีค่ะและไม่ได้ where ตไอดีด้วยค่ะ ขอบคุณมากค่ะ
ตอบกลับโพส

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 61