 |
MySQL ใครเซียนช่วยทีครับ ทำค้นหาข้อมูล SQL แล้วมันขึ้นเออเล่อ |
|
 |
|
|
 |
 |
|
ผมว่าคุณโพส code ที่ error ดีกว่านะครับ ส่งมาอย่างนี้ไม่รู้จะช่วยยังไงครับ
|
 |
 |
 |
 |
Date :
2013-02-16 15:53:38 |
By :
kokiflam |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เนี้ยครับ บนรรทัด if เป็นบรรทัดค้นหา
Code
mysql_select_db($database_project, $project);
$query_search_enroll = "SELECT personal.name, department.dep_name, class.cla_name, subject.code_sub, subject.sub_name, term.term_no, enroll.regis_date, subject.sub_name, class.cla_name, teacher.tea_name FROM term INNER JOIN (teacher INNER JOIN ((department INNER JOIN subject ON department.ID = subject.dep_id) INNER JOIN ((class INNER JOIN personal ON class.ID = personal.class_id) INNER JOIN enroll ON personal.ID = enroll.student_id) ON subject.ID = enroll.sub_id) ON teacher.ID = subject.tea_id) ON term.ID = enroll.term_id AND personal.id=personal.id; " ;
if(!empty($_POST['sub_name'])) $query_search_enroll.= " AND sub_name LIKE '%".$_POST['sub_name']."%'";
if(!empty($_POST['class_id'])) $query_search_enroll.= " AND class_id LIKE '%".$_POST['class_id']."%'";
if(!empty($_POST['dep_id'])) $query_search_enroll.= " AND dep_id = '".$_POST['dep_id']."'";
if(!empty($_POST['regis_date'])) $query_search_enroll.= " AND regis_date LIKE %'".$_POST['regis_date']."%'";
if(!empty($_POST['tea_id'])) $query_search_enroll.= " AND tea_id = '".$_POST['tea_id']."'";
|
 |
 |
 |
 |
Date :
2013-02-16 16:05:34 |
By :
Piz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใส่ insert tag php ด้วยครับ เดี๋ยวจะแวะมาช่วยหาคำตอบ
|
 |
 |
 |
 |
Date :
2013-02-16 16:07:28 |
By :
Ex-[S]i[L]e[N]t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
mysql_select_db($database_project, $project);
$query_search_enroll = "SELECT personal.name, department.dep_name, class.cla_name, subject.code_sub, subject.sub_name, term.term_no, enroll.regis_date, subject.sub_name, class.cla_name, teacher.tea_name FROM term INNER JOIN (teacher INNER JOIN ((department INNER JOIN subject ON department.ID = subject.dep_id) INNER JOIN ((class INNER JOIN personal ON class.ID = personal.class_id) INNER JOIN enroll ON personal.ID = enroll.student_id) ON subject.ID = enroll.sub_id) ON teacher.ID = subject.tea_id) ON term.ID = enroll.term_id AND personal.id=personal.id; " ;
if(!empty($_POST['sub_name'])) $query_search_enroll.= " AND sub_name LIKE '%".$_POST['sub_name']."%'";
if(!empty($_POST['class_id'])) $query_search_enroll.= " AND class_id LIKE '%".$_POST['class_id']."%'";
if(!empty($_POST['dep_id'])) $query_search_enroll.= " AND dep_id = '".$_POST['dep_id']."'";
if(!empty($_POST['regis_date'])) $query_search_enroll.= " AND regis_date LIKE %'".$_POST['regis_date']."%'";
if(!empty($_POST['tea_id'])) $query_search_enroll.= " AND tea_id = '".$_POST['tea_id']."'";
|
 |
 |
 |
 |
Date :
2013-02-16 16:17:30 |
By :
Ex-[S]i[L]e[N]t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใส่ แทก php ครอบหมดแล้วครับ ที่มันเออเล้อ น่าจะเกิดกับ มัน WHERE ข้อมูลตารางซ้อนตารางรึป่าวครับ ?
|
 |
 |
 |
 |
Date :
2013-02-16 16:37:53 |
By :
Piz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2013-02-16 16:52:36 |
By :
weaned |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใน query นะครับ
$query_search_enroll = "SELECT personal.name, department.dep_name, class.cla_name, subject.code_sub, subject.sub_name, term.term_no, enroll.regis_date, subject.sub_name, class.cla_name, teacher.tea_name FROM term INNER JOIN (teacher INNER JOIN ((department INNER JOIN subject ON department.ID = subject.dep_id) INNER JOIN ((class INNER JOIN personal ON class.ID = personal.class_id) INNER JOIN enroll ON personal.ID = enroll.student_id) ON subject.ID = enroll.sub_id) ON teacher.ID = subject.tea_id) ON term.ID = enroll.term_id AND personal.id=personal.id; " ; // เซมิโคลอนหลัง AND personal.id=personal.id
เอาเซมิโคลอน ท้าย AND personal.id=personal.id; ออกครับ
|
 |
 |
 |
 |
Date :
2013-02-16 16:55:21 |
By :
cookiephp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มันขึ้นเออเล่ออย่างนี้แทนอ่าครับ แง้ๆๆ โปรเจคไม่ผ่านแน่ๆ เลย
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DESC class INNER JOIN (term INNER JOIN (teacher INNER JOIN ((department INNER JO' at line 1
|
 |
 |
 |
 |
Date :
2013-02-16 19:33:31 |
By :
Piz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คิวรี่นี้ใช้ทามอารายคับ
อะทิบายโหน่ย
ผมว่ามันซับซ้อนไปรึเป่า มันถึงมีเออเล่อ
อาจจะช่วยปรับแก้ให้ได้ถ้าคุนอะทิบายได้ว่าคุนกำลังจะทามอาราย
|
ประวัติการแก้ไข 2013-02-16 19:51:25
 |
 |
 |
 |
Date :
2013-02-16 19:47:31 |
By :
cookiephp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โปรเจคลงทะเบียนเรียนออนไลน์ครับ
โค้ดที่ว่านี้เอาไว้ค้นหารายชื่อผู้ที่ลงทะเบียนหนะครับ ตารางหลักที่ใช้คือ enroll เก็บไอดีของ department , class ,group ,term ,personal
ครับ ช่วยหน่อยนะครับ โปรเจคไม่ผ่านแน่ๆ เลยถ้าทำหน้านี้ไม่ได้

|
 |
 |
 |
 |
Date :
2013-02-16 19:55:30 |
By :
Piz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
หรือไม่ก็ช่วย echo คิวรี่ให้ดูโหน่ย ตัวแปร $query_search_enroll ที่แบบสมบูรณ์แล้ว ก่อนเอาไปรันใน mysql_query() อ่ะ
เพราะเหมือนจะมีเออเล่อที่เข็มขัดสั้น
|
 |
 |
 |
 |
Date :
2013-02-16 19:56:25 |
By :
cookiephp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ซีเล็กออกมาปกติครับ แต่ตอนค้นหามันเออเล่อ ปวดหัวมากๆเลย หุหุ

|
 |
 |
 |
 |
Date :
2013-02-16 20:02:51 |
By :
Piz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ก้อบอกให้ echo ออกมาให้ดูโหน่ยงาย
mysql_select_db($database_project, $project);
$query_search_enroll = "SELECT personal.name, department.dep_name, class.cla_name, subject.code_sub, subject.sub_name, term.term_no, enroll.regis_date, subject.sub_name, class.cla_name, teacher.tea_name FROM term INNER JOIN (teacher INNER JOIN ((department INNER JOIN subject ON department.ID = subject.dep_id) INNER JOIN ((class INNER JOIN personal ON class.ID = personal.class_id) INNER JOIN enroll ON personal.ID = enroll.student_id) ON subject.ID = enroll.sub_id) ON teacher.ID = subject.tea_id) ON term.ID = enroll.term_id AND personal.id=personal.id; " ;
if(!empty($_POST['sub_name'])) $query_search_enroll.= " AND sub_name LIKE '%".$_POST['sub_name']."%'";
if(!empty($_POST['class_id'])) $query_search_enroll.= " AND class_id LIKE '%".$_POST['class_id']."%'";
if(!empty($_POST['dep_id'])) $query_search_enroll.= " AND dep_id = '".$_POST['dep_id']."'";
if(!empty($_POST['regis_date'])) $query_search_enroll.= " AND regis_date LIKE %'".$_POST['regis_date']."%'";
if(!empty($_POST['tea_id'])) $query_search_enroll.= " AND tea_id = '".$_POST['tea_id']."'";
// ... หลังจากนี้คงมีอื่นๆ อีก
// แต่ขอให้ทำตรงนี้ ก่อนที่จะใช้ mysql_query()
echo $query_search_enroll; // ช่วยทำแบบนี้ แล้วส่งผลมาให้ดูหน่อยครับ เข้าใจมิ
mysql_query($query_search_enroll);
|
 |
 |
 |
 |
Date :
2013-02-16 20:10:53 |
By :
cookiephp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เฮ้อ ...
|
 |
 |
 |
 |
Date :
2013-02-16 20:26:08 |
By :
cookiephp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โทดทีครับ ผมไม่ค่อยเก่งเรื่องนี้เท่าไร ผมยังเปนนักศึกษาอยู่เลย T_T"
|
 |
 |
 |
 |
Date :
2013-02-16 20:28:49 |
By :
Piz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอาไอดี TeamViewer ผมเข้ามาดูเลยไหม ^^"
|
 |
 |
 |
 |
Date :
2013-02-16 20:32:20 |
By :
Piz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มันไม่เกี่ยวกับเก่งหรือไม่เก่ง แต่คุณไม่ทำอ่ะครับ
ผมบอกให้ทำอะไรข้างบน ก็ช่วยทำหน่อยสิครับ ถ้าไม่ทำผมจะช่วยได้ยังไง
echo ตัวแปร $query_search_enroll นี้ ก่อนจะถึงบรรทัดที่มีการเรียก
mysql_query($query_search_enroll)
ซึ่งมันต้องมีแน่นอน ลองหาดูครับ
ใส่โค้ด
echo $query_search_enroll;
exit;
ไว้ก่อนหน้าบรรทัดนั้น
และนำผลมาให้ดูครับ
|
 |
 |
 |
 |
Date :
2013-02-16 20:38:05 |
By :
cookiephp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อย่างี้ป่าวครับ ? อย่าด่าผมนะ ผมโง่จิงๆ T_T"
SELECT personal.name, department.dep_name, class.cla_name, subject.code_sub, subject.sub_name, term.term_no, enroll.regis_date, subject.sub_name, teacher.tea_name FROM term INNER JOIN (teacher INNER JOIN ((department INNER JOIN subject ON department.ID = subject.dep_id) INNER JOIN ((class INNER JOIN personal ON class.ID = personal.class_id) INNER JOIN enroll ON personal.ID = enroll.student_id) ON subject.ID = enroll.sub_id) ON teacher.ID = subject.tea_id) ON term.ID = enroll.term_id AND personal.id=personal.id
Query was empty
|
 |
 |
 |
 |
Date :
2013-02-16 20:44:56 |
By :
Piz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใช่ครับ แต่ลองแบบมีการค้นหาด้วยครับ ลองใส่พวกคีย์เวิร์ดหรือเงื่อนไขที่ใช้ค้นหาลงไปด้วยครับ
แต่จะให้ดี เอาโค้ดมาให้หมดครับ จะได้ดูว่ามันจะมีที่ผิดตรงอื่นได้อีกหรือเปล่า
|
 |
 |
 |
 |
Date :
2013-02-16 20:49:42 |
By :
cookiephp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php require_once('Connections/project.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;
}
}
mysql_select_db($database_project, $project);
$query_department = "SELECT * FROM department ORDER BY dep_name ASC";
$department = mysql_query($query_department, $project) or die(mysql_error());
$row_department = mysql_fetch_assoc($department);
$totalRows_department = mysql_num_rows($department);
mysql_select_db($database_project, $project);
$query_class = "SELECT * FROM `class` ORDER BY cla_name ASC";
$class = mysql_query($query_class, $project) or die(mysql_error());
$row_class = mysql_fetch_assoc($class);
$totalRows_class = mysql_num_rows($class);
$maxRows_search_enroll = 10;
$pageNum_search_enroll = 0;
if (isset($_GET['pageNum_search_enroll'])) {
$pageNum_search_enroll = $_GET['pageNum_search_enroll'];
}
$startRow_search_enroll = $pageNum_search_enroll * $maxRows_search_enroll;
mysql_select_db($database_project, $project);
$query_search_enroll = "SELECT personal.name, department.dep_name, class.cla_name, subject.code_sub, subject.sub_name, term.term_no, enroll.regis_date, subject.sub_name, teacher.tea_name FROM term INNER JOIN (teacher INNER JOIN ((department INNER JOIN subject ON department.ID = subject.dep_id) INNER JOIN ((class INNER JOIN personal ON class.ID = personal.class_id) INNER JOIN enroll ON personal.ID = enroll.student_id) ON subject.ID = enroll.sub_id) ON teacher.ID = subject.tea_id) ON term.ID = enroll.term_id AND personal.id=personal.id ";
if(!empty($_POST['sub_name'])) $query_search_enroll.= " AND sub_name LIKE '%".$_POST['sub_name']."%'";
if(!empty($_POST['class_id'])) $query_search_enroll.= " AND class_id LIKE '%".$_POST['class_id']."%'";
if(!empty($_POST['dep_id'])) $query_search_enroll.= " AND dep_id = '".$_POST['dep_id']."'";
if(!empty($_POST['regis_date'])) $query_search_enroll.= " AND regis_date LIKE %'".$_POST['regis_date']."%'";
if(!empty($_POST['tea_id'])) $query_search_enroll.= " AND tea_id = '".$_POST['tea_id']."'";
echo $query_search_enroll;
$search_enroll = mysql_query($query_limit_search_enroll, $project) or die(mysql_error());
$row_search_enroll = mysql_fetch_assoc($search_enroll);
if (isset($_GET['totalRows_search_enroll'])) {
$totalRows_search_enroll = $_GET['totalRows_search_enroll'];
} else {
$all_search_enroll = mysql_query($query_search_enroll);
$totalRows_search_enroll = mysql_num_rows($all_search_enroll);
}
$totalPages_search_enroll = ceil($totalRows_search_enroll/$maxRows_search_enroll)-1;
?>
Code (HTML)
<html>
<head>
<title>. : ระบบลงทะเบียนเรียนออนไลน์ : .</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="Style.css" rel="stylesheet" type="text/css">
</head>
<body id="body1" bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form id="form1" method="post"><center>
<!-- Save for Web Slices (project piz.psd) -->
<table id="Table_01" width="1001" height="750" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="8" background="images/template_01.png" width="1000" height="25" alt="">
</td>
<td>
<img src="images/spacer.gif" width="1" height="25" alt=""></td>
</tr>
<tr>
<td colspan="8"><a href="index.php"><img src="images/template_02.png" width="1000" height="100" alt=""></a></td>
<td>
<img src="images/spacer.gif" width="1" height="100" alt=""></td>
</tr>
<tr>
<td colspan="8" background="images/template_03.png" width="1000" height="25" alt="">
</td>
<td>
<img src="images/spacer.gif" width="1" height="25" alt=""></td>
</tr>
<tr>
<td rowspan="3" background="images/template_04.png" width="55" height="100" alt="">
</td>
<td background="images/bg2.png"><a href="index.php?id=<?php echo $_SESSION['id']; ?>"><img src="images/template_05.png" width="145" height="50" alt=""></a></td>
<td background="images/bg2.png"><a href="profile.php?id=<?php echo $_SESSION['id']; ?>"><img src="images/template_06.png" width="150" height="50" alt=""></a></td>
<td background="images/bg2.png"><a href="signup.php"><img src="images/template_07.png" width="150" height="50" alt=""></a></td>
<td background="images/bg2.png"><a href="enroll.php?id=<?php echo $_SESSION['id']; ?>"><img src="images/template_08.png" width="150" height="50" alt=""></a></td>
<td background="images/bg2.png"><a href="step.php"><img src="images/template_09.png" width="150" height="50" alt=""></a></td>
<td background="images/bg2.png"><?php if($_SESSION['status']>1) { ?><a href="admin.php"><img src="images/template_10.png" width="145" height="50" alt=""></a><?php } ?></td>
<td rowspan="3" background="images/template_11.png" width="55" height="100" alt="">
</td>
<td>
<img src="images/spacer.gif" width="1" height="50" alt=""></td>
</tr>
<tr>
<td colspan="6" background="images/template_12.png" width="890" height="25" alt="">
</td>
<td>
<img src="images/spacer.gif" width="1" height="25" alt=""></td>
</tr>
<tr>
<td width="890" height="25" colspan="6" align="left" valign="top" bgcolor="#eb7373"></td>
<td>
<img src="images/spacer.gif" width="1" height="25" alt=""></td>
</tr>
<tr>
<td background="images/template_14.png" width="55" height="450" alt="">
</td>
<td width="890" height="450" colspan="6" align="left" valign="top"><table height="100%" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="23%" height="143" align="left" valign="top"><iframe width="100%" height="100%" frameborder="0" scrolling="no" src="loginfinish.php"></iframe></td>
<td width="77%" rowspan="2" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><h3>ค้นหารายการลงทะเบียน</h3>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8%"> </td>
<td width="10%" align="right"><h4>วิชา</h4></td>
<td width="20%"><label for="sub_name"></label>
<input type="text" name="sub_name" id="sub_name"></td>
<td width="20%" align="right"><h4>ครูผู้สอน</h4></td>
<td width="42%"><label for="tea_id"></label>
<input type="text" name="tea_id" id="tea_id"></td>
</tr>
<tr>
<td> </td>
<td align="right"><h4>แผนก</h4></td>
<td><label for="dep_id"></label>
<select name="dep_id" id="dep_id">
<option value="">เลือก...</option>
<?php
do {
?>
<option value="<?php echo $row_department['id']?>"><?php echo $row_department['dep_name']?></option>
<?php
} while ($row_department = mysql_fetch_assoc($department));
$rows = mysql_num_rows($department);
if($rows > 0) {
mysql_data_seek($department, 0);
$row_department = mysql_fetch_assoc($department);
}
?>
</select></td>
<td align="right"><h4>ชั้นปี</h4></td>
<td><select name="class_id" id="class_id">
<option value="">เลือก...</option>
<?php
do {
?>
<option value="<?php echo $row_class['id']?>"><?php echo $row_class['cla_name']?></option>
<?php
} while ($row_class = mysql_fetch_assoc($class));
$rows = mysql_num_rows($class);
if($rows > 0) {
mysql_data_seek($class, 0);
$row_class = mysql_fetch_assoc($class);
}
?>
</select></td>
</tr>
<tr>
<td> </td>
<td align="right"><h4>วันที่ลงทะเบียน</h4></td>
<td><input type="text" name="regis_date" id="regis_date"></td>
<td align="right"> </td>
<td> </td>
</tr>
<tr>
<td colspan="5" align="center"><p>
<input type="submit" name="search" id="search" value="ค้นหา">
<input type="reset" name="search2" id="search2" value="ยกเลิก">
</p>
<hr>
<p> </p></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><h4>รหัสวิชา</h4></td>
<td align="center"><h4>ชื่อวิชา</h4></td>
<td align="center"><h4>ครุผู้สอน</h4></td>
<td align="center"><h4>ชื่อนักเรียน</h4></td>
<td align="center"><h4>แผนก</h4></td>
<td align="center"><h4>ชั้นปี</h4></td>
<td align="center"><h4>วันที่ลงทะเบียน</h4></td>
<td align="center"><h4>เทอม</h4></td>
</tr>
<?php do { ?>
<tr>
<td><h5><?php echo $row_search_enroll['code_sub']; ?></h5></td>
<td><h5><?php echo $row_search_enroll['sub_name']; ?></h5></td>
<td><h5><?php echo $row_search_enroll['tea_name']; ?></h5></td>
<td><h5><?php echo $row_search_enroll['name']; ?></h5></td>
<td><h5><?php echo $row_search_enroll['dep_name']; ?></h5></td>
<td align="center"><h5><?php echo $row_search_enroll['cla_name']; ?></h5></td>
<td align="center"><h5><?php echo $row_search_enroll['regis_date']; ?></h5></td>
<td align="center"><h5><?php echo $row_search_enroll['term_no']; ?></h5></td>
</tr>
<?php } while ($row_search_enroll = mysql_fetch_assoc($search_enroll)); ?>
<tr>
<td>
<h5> </h5></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<p> </p></td>
</tr>
</table></td>
</tr>
<tr>
<td align="left" valign="top"> </td>
</tr>
</table> </td>
<td background="images/template_15.png" width="55" height="450" alt="">
</td>
<td>
<img src="images/spacer.gif" width="1" height="450" alt=""></td>
</tr>
<tr>
<td colspan="8" background="images/template_16.png" width="1000" height="50" alt="">
</td>
<td>
<img src="images/spacer.gif" width="1" height="50" alt=""></td>
</tr>
</table>
<!-- End Save for Web Slices -->
</center></form>
</body>
</html>
<?php
mysql_free_result($department);
mysql_free_result($class);
mysql_free_result($search_enroll);
?>
|
 |
 |
 |
 |
Date :
2013-02-16 20:53:25 |
By :
Piz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
บรรทัดที่ 64 ตัวแปร $query_limit_search_enroll นี่มาจากไหนครับ
คราวนี้ ตัด echo $query_search_enroll; บรรทัด 62 ทิ้งนะครับ
แล้วเพิ่ม
echo $query_search_enroll; exit;
ไว้ก่อน บรรทัดที่ 70 $all_search_enroll = mysql_query($query_search_enroll);
แล้วลองรันดูหน่อยครับ รันแบบมีการค้นหาด้วยเงื่อนไขนะครับ ขอผลที่ได้ด้วย
|
ประวัติการแก้ไข 2013-02-16 21:04:24
 |
 |
 |
 |
Date :
2013-02-16 21:02:45 |
By :
cookiephp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
echo $query_search_enroll; exit; ใส่แล้วเปิดไม่ได้เลยครับ แสดงแต่ search_enrol
ผมเปลี่ยน $query_limit_search_enroll เป็น $search_enroll = mysql_query($query_search_enroll, $project) or die(mysql_error());
แล้วค้นหาแบบมีเงื่อนไข tea_id ค้นหาได้ class_id ค้นหาได้
เงื่อนไข dep_id ,regis_date,sub_name เออเล่อแบบนี้เลยครับ
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%'2013%'' at line 1
|
 |
 |
 |
 |
Date :
2013-02-16 21:19:43 |
By :
Piz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โอว เจอแล้วครับ
อยู่ที่เงื่อนไข regis_date
if(!empty($_POST['regis_date'])) $query_search_enroll.= " AND regis_date LIKE %'".$_POST['regis_date']."%'";
ต้องเป็น LIKE '%".$_POST['regis_date']."%'
|
ประวัติการแก้ไข 2013-02-16 21:31:15
 |
 |
 |
 |
Date :
2013-02-16 21:29:23 |
By :
cookiephp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม้ได่อ่ะครับ ขึ้นเออเล่ออยู่ดี โอ้ยย ปวดหัวจิง
|
 |
 |
 |
 |
Date :
2013-02-16 21:43:53 |
By :
Piz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โค๊ดทั้งหมดนี่อยู่หน้าเดียวกันใช่ไหมครับ เดวผมช่วยอีกแรงนึงครับ
|
 |
 |
 |
 |
Date :
2013-02-16 22:01:16 |
By :
weaned |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เหลือแต่ dep_id ครับ ที่เหลือไดเหมดละ
Column 'dep_id' in on clause is ambiguous
|
 |
 |
 |
 |
Date :
2013-02-16 22:02:58 |
By :
Piz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอาโค๊ดล่าสุดมาโฟส
|
 |
 |
 |
 |
Date :
2013-02-16 22:06:40 |
By :
weaned |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่ต้องโพสโค้ด PHP แล้วครับ เพราะ error ที่เหลือมันอยู่ที่ SQL แล้ว
|
 |
 |
 |
 |
Date :
2013-02-16 22:09:15 |
By :
cookiephp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
การที่จะขอความช่วยเหลือของคนอื่น ๆ ในบอร์ดนี้....สิ่งที่ผมจะคอยแนะนำเสมอคือ
1.สมัครสมาชิก จะได้ดูเหมือนเป็นคนในครอบครัวเดียวกัน การเป็นสมาชิกนั้น จะย่อมมีคนช่วยเหลือมาก.....
2.เจ้าของกระทู้ คุณเข้ามาอ่าน คุณควรอ่าน ทุกคอมเม้นท์ อ้างอิงคอมเม้นท์นั้น ๆ ว่าคุณทำอะไรไปบ้างแล้ว << ซึ่งตรงนี้ไม่เกี่ยวง่าจะเป็นใครก็ทำได้ แม้เป็นนักศึกษาอยู่ก็ทำได้
3. จากข้อ 2 ถ้าคุณตอบได้ทุกอัน คนที่เค้าช่วยเหลือคุณอยู่จะได้ความคืบหน้า เหมือนหมอซักอาการคนป่วย คุณต้องตอบครับ อย่าก้มหน้าก้มตารอแต่ Code
4.ระหว่างที่รอคนอื่นเค้าช่วย คุณก็ต้องแก้ไขของคุณรอไปด้วย......ลองแก้ตรงนั้น ใส่ตรงนี้ ง่ายที่สุดของการเขียน Code ของน้องควรไล่ syntax ใหม่ให้ละเอียด...
เพราะมาอ่านแล้วเหนื่อยแทน....
|
 |
 |
 |
 |
Date :
2013-02-16 22:30:35 |
By :
apisitp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ซึ้งเลย...
|
 |
 |
 |
 |
Date :
2013-02-16 22:43:51 |
By :
weaned |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่ได้เอาซึ้ง....แต่กลัวโปรเจ็คไม่ผ่าน ฮ่าๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆๆ
|
 |
 |
 |
 |
Date :
2013-02-17 08:18:27 |
By :
apisitp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|