|
 |
|
สอบถามปัญหาเรื่องการส่งค่า std_id มาจากอีกหน้านึงแล้วมาเทียบค่าให้เท่ากับ std_id อีกหน้านึงเพื่อแสดงข้อมูล รบกวนด้วยครับ |
|
 |
|
|
 |
 |
|
ในรูปยังคงแสดงข้อมูลทั้งหมดอยู่ยังไม่ได้เทียบค่าเพื่อแสดง โดยส่งค่า std_id มาได้แล้ว

ส่วนนี้เป็นส่วนข้อโค๊ดที่แสดงข้อมูลเขียนจาก DreamweaverCs5
ผมอยากให้แสดงข้อมูลแค่บรรทัดเดียวโดยเทียบค่า std_id ที่ส่งมาเพื่อแสดงข้อมูลหน้านี้ครับ
รบกวนพี่ๆ TC ด้วยครับ
Code (PHP)
<?php require_once('../Connections/manage_stdcard.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$maxRows_stdcard = 10;
$pageNum_stdcard = 0;
if (isset($_GET['pageNum_stdcard'])) {
$pageNum_stdcard = $_GET['pageNum_stdcard'];
}
$startRow_stdcard = $pageNum_stdcard * $maxRows_stdcard;
mysql_select_db($database_manage_stdcard, $manage_stdcard);
$query_stdcard = "SELECT student.std_id, student.std_name, student.std_code, student.std_brand, student.std_program, student.std_name_parent, student.std_addrss_parent, student.std_tel_parent, album.AlbumShot FROM student, album WHERE student.std_id = album.AlbumID";
$query_limit_stdcard = sprintf("%s LIMIT %d, %d", $query_stdcard, $startRow_stdcard, $maxRows_stdcard);
$stdcard = mysql_query($query_limit_stdcard, $manage_stdcard) or die(mysql_error());
$row_stdcard = mysql_fetch_assoc($stdcard);
if (isset($_GET['totalRows_stdcard'])) {
$totalRows_stdcard = $_GET['totalRows_stdcard'];
} else {
$all_stdcard = mysql_query($query_stdcard);
$totalRows_stdcard = mysql_num_rows($all_stdcard);
}
$totalPages_stdcard = ceil($totalRows_stdcard/$maxRows_stdcard)-1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table border="1">
<tr>
<td>std_id</td>
<td>std_name</td>
<td>std_code</td>
<td>std_brand</td>
<td>std_program</td>
<td>std_name_parent</td>
<td>std_addrss_parent</td>
<td>std_tel_parent</td>
<td>AlbumShot</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_stdcard['std_id']; ?></td>
<td><?php echo $row_stdcard['std_name']; ?></td>
<td><?php echo $row_stdcard['std_code']; ?></td>
<td><?php echo $row_stdcard['std_brand']; ?></td>
<td><?php echo $row_stdcard['std_program']; ?></td>
<td><?php echo $row_stdcard['std_name_parent']; ?></td>
<td><?php echo $row_stdcard['std_addrss_parent']; ?></td>
<td><?php echo $row_stdcard['std_tel_parent']; ?></td>
<td><?php echo $row_stdcard['AlbumShot']; ?></td>
</tr>
<?php } while ($row_stdcard = mysql_fetch_assoc($stdcard)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($stdcard);
?>
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2012-01-12 07:59:00 |
By :
siwarin125 |
View :
863 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
หมายถึงจะให้แสดงข้อมูลแต่รายการ std เฉพาะค่าที่ส่งมาใช้ไหมค่ะ
ถ้าใช่ ก็เอาค่า $_GET['std_id'] มาใช้ตอน query เพิ่ม where ว่า std_id = $_GET['std_id']
ก็จะออกมาข้อมูลเดียวและ
|
 |
 |
 |
 |
Date :
2012-01-12 08:48:25 |
By :
LuckyStar |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
$query_stdcard = "SELECT student.std_id, student.std_name, student.std_code, student.std_brand, student.std_program, student.std_name_parent, student.std_addrss_parent, student.std_tel_parent, album.AlbumShot FROM student, album WHERE student.std_id = album.AlbumID and student.std_id = '".$_GET["std_id"]."' ";
|
 |
 |
 |
 |
Date :
2012-01-12 09:04:53 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอขอบพระคุณ code ของพี่วินมากครับ ได้แล้วครับ และขอขอบคุณพี่ Luckystar ด้วยครับ
|
 |
 |
 |
 |
Date :
2012-01-12 13:49:35 |
By :
siwarin125 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|