Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > PHP > PHP Forum > วานพี่ๆสมาชิกชวนแก้ปัญหา code php นี้ให้ด้วยครับ พอดี ว่าจะทำเป็นโปรเจ๊คนะครับเพิ่งเริ่มหัดทำ php ได้



 

วานพี่ๆสมาชิกชวนแก้ปัญหา code php นี้ให้ด้วยครับ พอดี ว่าจะทำเป็นโปรเจ๊คนะครับเพิ่งเริ่มหัดทำ php ได้

 



Topic : 039581



โพสกระทู้ ( 12 )
บทความ ( 0 )



สถานะออฟไลน์




พอดี ว่าจะทำเป็นโปรเจ๊คนะครับเพิ่งเริ่มหัดทำ php ได้ code จากรุ่นพี่มาอีกทีติดต่อรุ่นพี่ก็ไม่ได้ช่วยด้วยนะครับ
ใช้appserv 2.5.9
----------------------------------------------------------------------------------------------------------------------------------------

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\etip\report_examine1.php:26) in C:\AppServ\www\etip\rptinc\ewcommon.php on line 6

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\etip\report_examine1.php:26) in C:\AppServ\www\etip\rptinc\ewcommon.php on line 7

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\etip\report_examine1.php:26) in C:\AppServ\www\etip\rptinc\ewcommon.php on line 8

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\etip\report_examine1.php:26) in C:\AppServ\www\etip\rptinc\ewcommon.php on line 9

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\etip\report_examine1.php:26) in C:\AppServ\www\etip\rptinc\ewcommon.php on line 10
660: Illegal mix of collations for operation 'concat'
SQL: SELECT DISTINCT 'numST' AS FIELD_1, concat( etp_defend.dfn_date, '
', etp_defend.start_time, '-', etp_defend.end_time, ' ¹.' ) AS FIELD_2, concat( etp_student.std_title, etp_student.std_fname_thai, ' ', etp_student.std_lname_thai, '
', etp_student.std_id, '
', etp_plan.plan_name ) AS FIELD_3, concat( etp_defend.proposal_name_thai, '
(', etp_plan_type.plan_type_name ,')' ) AS FIELD_4, concat( etp_teacher.tea_position, etp_teacher.tea_fname_thai, ' ', etp_teacher.tea_lname_thai ) AS FIELD_5, etp_place.place_name FROM etp_student INNER JOIN etp_defend ON ( etp_student.std_id = etp_defend.std_id ) INNER JOIN etp_place ON ( etp_defend.place_id = etp_place.place_id ) INNER JOIN etp_plan ON ( etp_student.plan_id = etp_plan.plan_id ) INNER JOIN etp_plan_type ON ( etp_plan.plan_type_id = etp_plan_type.plan_type_id ) INNER JOIN etp_committee ON ( etp_defend.dfn_no = etp_committee.dfn_no ) AND ( etp_defend.dfn_type_id = etp_committee.dfn_type_id ) AND ( etp_defend.std_id = etp_committee.std_id )INNER JOIN etp_teacher ON ( etp_committee.tea_id = etp_teacher.tea_id ) WHERE ( (etp_defend.dfn_type_id = '01' ) and (etp_defend.is_pass = '' ) ) ORDER BY FIELD_2 , etp_committee.pos_id asc

---------------------------------------------------------------------------------------------------------------------------------------
code ของ ewcommon.php **

<?php
session_start();
ob_start();
?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php
if (@phpversion() >= '5.0.0' && (!@ini_get('register_long_arrays') || @ini_get('register_long_arrays') == '0' || strtolower(@ini_get('register_long_arrays')) == 'off')) { // PHP5 with register_long_arrays off
$PHP_POST =& $_POST;
$PHP_GET =& $_GET;
$PHP_SERVER =& $_SERVER;
$PHP_COOKIE =& $_COOKIE;
$PHP_ENV =& $_ENV;
$PHP_FILES =& $_FILES;
if (isset($_SESSION)) $PHP_SESSION =& $_SESSION;
} else {
$PHP_POST =& $HTTP_POST_VARS;
$PHP_GET =& $HTTP_GET_VARS;
$PHP_SERVER =& $HTTP_SERVER_VARS;
$PHP_COOKIE =& $HTTP_COOKIE_VARS;
$PHP_ENV =& $HTTP_ENV_VARS;
$PHP_FILES =& $HTTP_POST_FILES;
if (isset($_SESSION)) $PHP_SESSION =& $HTTP_SESSION_VARS;
}
?>
-------------------------------------------------------------------------------------------------------------------------------------
code ของ report_examine1.php

<?
session_start();

if(false&&$HTTP_SESSION_VARS[s_class] != 1){ ?>
<?php include "rptinc/header2.php"; ?>
<TABLE cellSpacing=8 cellPadding=0 width="99%" align=center border=0>

<TR><TD colspan='2' align='center' height=24><DIV class=linkheader2><STRONG>แจ้งข้อความ</STRONG></DIV></TD></TR>

<TR class=bodygrey11space>
<TD vAlign=top width=5><IMG height=13 src="rptimages/bullet.gif" width=12></TD>
<TD>หน้านี้จำกัดสิทธิ์เฉพาะผู้ดูแลระบบ</TD>
</TR>
<TR class=bodygrey11space>
<TD vAlign=top width=5><IMG height=13 src="rptimages/bullet.gif" width=12></TD>
<TD>กรุณาทำการ login เข้าสู่ระบบจากเมนูด้านซ้ายมือ &nbsp;ด้วยชื่อและรหัสผ่านของผู้ดูแลระบบ</TD>
</TR>

</TABLE>
<?php include "rptinc/footer.php"; ?>
<?
exit();
}else{ // else ใหญ่?>
<? } // จบ else ใหญ่ ?>

<?php include "rptinc/ewcommon.php"; ?>
<?php include "rptinc/ewconfig.php"; ?>
<?php include "rptinc/phprptfn.php"; ?>
<?php include "rptinc/advsecu.php"; ?>
<?php

// Table Level Constants

define("EW_TABLE_VAR", "ตารางการสอบเค้าโครง" , TRUE);
define("EW_TABLE_GROUP_PER_PAGE", "grpperpage", TRUE);
define("EW_TABLE_SESSION_GROUP_PER_PAGE", "report_examine_grpperpage", TRUE);
define("EW_TABLE_START_GROUP", "start", TRUE);
define("EW_TABLE_SESSION_START_GROUP", "report_examine_start", TRUE);
define("EW_TABLE_SESSION_SEARCH", "report_examine_search", TRUE);
define("EW_TABLE_CHILD_USER_ID", "childuserid", TRUE);
define("EW_TABLE_SESSION_CHILD_USER_ID", "report_examine_childuserid", TRUE);

// Table Level SQL
define("EW_TABLE_SQL_FROM", " etp_student INNER JOIN etp_defend ON ( etp_student.std_id = etp_defend.std_id ) INNER JOIN etp_place ON ( etp_defend.place_id = etp_place.place_id ) INNER JOIN etp_plan ON ( etp_student.plan_id = etp_plan.plan_id ) INNER JOIN etp_plan_type ON ( etp_plan.plan_type_id = etp_plan_type.plan_type_id ) INNER JOIN etp_committee ON ( etp_defend.dfn_no = etp_committee.dfn_no ) AND ( etp_defend.dfn_type_id = etp_committee.dfn_type_id ) AND ( etp_defend.std_id = etp_committee.std_id )INNER JOIN etp_teacher ON ( etp_committee.tea_id = etp_teacher.tea_id )", TRUE);
$EW_TABLE_SQL_SELECT = " SELECT DISTINCT 'numST' AS FIELD_1, concat( etp_defend.dfn_date, '<br>', etp_defend.start_time, '-', etp_defend.end_time, ' น.' ) AS FIELD_2, concat( etp_student.std_title, etp_student.std_fname_thai, ' ', etp_student.std_lname_thai, '<br>', etp_student.std_id, '<br>', etp_plan.plan_name ) AS FIELD_3, concat( etp_defend.proposal_name_thai, '<br>(', etp_plan_type.plan_type_name ,')' ) AS FIELD_4, concat( etp_teacher.tea_position, etp_teacher.tea_fname_thai, ' ', etp_teacher.tea_lname_thai ) AS FIELD_5, etp_place.place_name FROM " . EW_TABLE_SQL_FROM;
$EW_TABLE_SQL_WHERE = " (etp_defend.dfn_type_id = '01' ) and (etp_defend.is_pass = '' ) ";
if( ($_POST["date1"] != "") && ($_POST["date2"] != "") ){
//......................
}
$EW_TABLE_SQL_ORDER = "";
define("EW_TABLE_SQL_GROUPBY", "", TRUE);
define("EW_TABLE_SQL_HAVING", "", TRUE);
define("EW_TABLE_SQL_ORDERBY", " FIELD_2 , etp_committee.pos_id asc ", TRUE);
define("EW_TABLE_SQL_USERID_FILTER", "", TRUE);
$af_FIELD_1 = NULL; // Advanced filter for FIELD_1
$af_FIELD_2 = NULL; // Advanced filter for FIELD_2 วันเดือนปี
$af_FIELD_3 = NULL; // Advanced filter for FIELD_3 ชื่อ - สกุล
$af_FIELD_4 = NULL; // Advanced filter for FIELD_4 ชื่อเรื่อง
$af_FIELD_5 = NULL; // Advanced filter for FIELD_5 กรรมการ
$af_place_name = NULL; // Advanced filter for place_name
?>
<?php
$sExport = @$PHP_GET["export"]; // Load export request
if ($sExport == "excel") {
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename=' . EW_TABLE_VAR .'.xls');
}
if ($sExport == "word") {
header('Content-Type: application/vnd.ms-word');
header('Content-Disposition: attachment; filename=' . EW_TABLE_VAR .'.doc');
}
?>
<?php
?>
<?php

// Initialize common variables
// Paging variables

$x_FIELD_DATE_KEEP = "";
$x_FIELD_DATE_NEW = "";
$x_PLACE_Keep = "";
$x_FIELD_2_Old = "";
$x_FIELD_1_New = 0; // Record Count New
$nRecCount = 0; // Record Count
$nStartGrp = 0; // Start Group
$nStopGrp = 0; // Stop Group
$nTotalGrps = 0; // Total Groups
$nGrpCount = 0; // Group Count
$nDisplayGrps = 500; // Groups per page
$nGrpRange = 10;

// Detail variables
$x_FIELD_1 = NULL; $ox_FIELD_1 = NULL; $tx_FIELD_1 = NULL; $ftx_FIELD_1 = 200; $rf_FIELD_1 = NULL; $rt_FIELD_1 = NULL;
$x_FIELD_2 = NULL; $ox_FIELD_2 = NULL; $tx_FIELD_2 = NULL; $ftx_FIELD_2 = 200; $rf_FIELD_2 = NULL; $rt_FIELD_2 = NULL;
$x_FIELD_3 = NULL; $ox_FIELD_3 = NULL; $tx_FIELD_3 = NULL; $ftx_FIELD_3 = 201; $rf_FIELD_3 = NULL; $rt_FIELD_3 = NULL;
$x_FIELD_4 = NULL; $ox_FIELD_4 = NULL; $tx_FIELD_4 = NULL; $ftx_FIELD_4 = 201; $rf_FIELD_4 = NULL; $rt_FIELD_4 = NULL;
$x_FIELD_5 = NULL; $ox_FIELD_5 = NULL; $tx_FIELD_5 = NULL; $ftx_FIELD_5 = 200; $rf_FIELD_5 = NULL; $rt_FIELD_5 = NULL;
$x_place_name = NULL; $ox_place_name = NULL; $tx_place_name = NULL; $ftx_place_name = 200; $rf_place_name = NULL; $rt_place_name = NULL;
?>
<?php

// Open connection to the database
$conn = php_connect(HOST, USER, PASS, DB, PORT);

// Filter
$sFilter = "";
$bFilterApplied = FALSE;

// Aggregate variables
// 1st dimension = no of groups (level 0 used for grand total)
// 2nd dimension = no of fields

$nDtls = 7;
$nGrps = 1;
$val = ew_InitArray($nDtls, 0);
$cnt = ew_Init2DArray($nGrps, $nDtls, 0);
$smry = ew_Init2DArray($nGrps, $nDtls, 0);
$mn = ew_Init2DArray($nGrps, $nDtls, NULL);
$mx = ew_Init2DArray($nGrps, $nDtls, NULL);
$grandsmry = ew_InitArray($nDtls, 0);
$grandmn = ew_InitArray($nDtls, NULL);
$grandmx = ew_InitArray($nDtls, NULL);

// Set up if accumulation required
$col = array(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);

// Reset
ResetCmd();

// Set up groups per page dynamically
SetUpDisplayGrps();

// Set up selection
SetupSelection();

// Build sql
$sSql = ew_BuildReportSql("", $EW_TABLE_SQL_SELECT, $EW_TABLE_SQL_WHERE, EW_TABLE_SQL_GROUPBY, EW_TABLE_SQL_HAVING, EW_TABLE_SQL_ORDERBY, "", $sFilter, @$sSort);
//echo $sSql . "<br>";

// uncomment to show sql
// Load recordset

$rs = ew_LoadRs($sSql);
$rscnt = count($rs);
$row = FALSE;
$rsidx = 0;

// Detail distinct & selection values
InitReportData($rs);
if ($nDisplayGrps <= 0) { // Display All Records
$nDisplayGrps = $nTotalGrps;
}
$nStartGrp = 1;
SetUpStartGroup(); // Set Up Start Record Position
?>
<?php include "rptinc/header2.php"; ?>
<?php if (@$sExport == "") { ?>
<!-- import the calendar script -->
<script type="text/javascript" src="rptjs/calendar.js"></script>

<!-- import the language module -->
<script type="text/javascript" src="rptjs/lang/calendar-th.js"></script>

<script language="JavaScript" type="text/javascript">
// This function gets called when the end-user clicks on some date.
function selected(cal, date) {
cal.sel.value = date; // just update the date in the input field.
if (cal.dateClicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3"))
// if we add this call we close the calendar on single-click.
// just to exemplify both cases, we are using this only for the 1st
// and the 3rd field, while 2nd and 4th will still require double-click.
cal.callCloseHandler();
}

// And this gets called when the end-user clicks on the _selected_ date,
// or clicks on the "Close" button. It just hides the calendar without
// destroying it.
function closeHandler(cal) {
cal.hide(); // hide the calendar
// cal.destroy();
_dynarch_popupCalendar = null;
}

// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id, format, showsTime, showsOtherMonths) {
var el = document.getElementById(id);
if (_dynarch_popupCalendar != null) {
// we already have some calendar created
_dynarch_popupCalendar.hide(); // so we hide it first.
} else {
// first-time call, create the calendar.
var cal = new Calendar(1, null, selected, closeHandler);
// uncomment the following line to hide the week numbers
// cal.weekNumbers = false;
if (typeof showsTime == "string") {
cal.showsTime = true;
cal.time24 = (showsTime == "24");
}
if (showsOtherMonths) {
cal.showsOtherMonths = true;
}
_dynarch_popupCalendar = cal; // remember it in the global var
cal.setRange(1900, 2070); // min/max year allowed.
cal.create();
}
_dynarch_popupCalendar.setDateFormat(format); // set the specified date format
_dynarch_popupCalendar.parseDate(el.value); // try to parse the text in field
_dynarch_popupCalendar.sel = el; // inform it what input field we use

// the reference element that we pass to showAtElement is the button that
// triggers the calendar. In this example we align the calendar bottom-right
// to the button.
_dynarch_popupCalendar.showAtElement(el.nextSibling, "Br"); // show the calendar

return false;
}

var MINUTE = 60 * 1000;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
var WEEK = 7 * DAY;

// If this handler returns true then the "date" given as
// parameter will be disabled. In this example we enable
// only days within a range of 10 days from the current
// date.
// You can use the functions date.getFullYear() -- returns the year
// as 4 digit number, date.getMonth() -- returns the month as 0..11,
// and date.getDate() -- returns the date of the month as 1..31, to
// make heavy calculations here. However, beware that this function
// should be very fast, as it is called for each day in a month when
// the calendar is (re)constructed.
function isDisabled(date) {
var today = new Date();
return (Math.abs(date.getTime() - today.getTime()) / DAY) > 10;
}

function flatSelected(cal, date) {
var el = document.getElementById("preview");
el.innerHTML = date;
}

function showFlatCalendar() {
var parent = document.getElementById("display");

// construct a calendar giving only the "selected" handler.
var cal = new Calendar(0, null, flatSelected);

// hide week numbers
cal.weekNumbers = false;

// We want some dates to be disabled; see function isDisabled above
cal.setDisabledHandler(isDisabled);
cal.setDateFormat("%A, %B %e");

// this call must be the last as it might use data initialized above; if
// we specify a parent, as opposite to the "showCalendar" function above,
// then we create a flat calendar -- not popup. Hidden, though, but...
cal.create(parent);

// ... we can show it here.
cal.show();
}
</script>

<script language="JavaScript" src="rptjs/x/x_core.js" type="text/javascript"></script>
<script language="JavaScript" src="rptjs/x/x_event.js" type="text/javascript"></script>
<script language="JavaScript" src="rptjs/x/x_drag.js" type="text/javascript"></script>
<script language="JavaScript" src="rptjs/popup.js" type="text/javascript"></script>
<script language="JavaScript" src="rptjs/ewrptpop.js" type="text/javascript"></script>
<script language="JavaScript" src="rptjs/swfobject.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
<!--
var EW_POPUP_ALL = "(All)";
var EW_POPUP_OK = " OK ";
var EW_POPUP_CANCEL = "Cancel";
var EW_POPUP_FROM = "From";
var EW_POPUP_TO = "To";
var EW_POPUP_PLEASE_SELECT = "Please Select";
var EW_POPUP_NO_VALUE = "No value selected!";
var EW_POPUP_CLASSNAME = "phpreportmaker";

// popup fields
//-->

</script>
<?php } ?>
<?php if (@$sExport == "") { ?>
<!-- Table Container (Begin) -->
<table id="ewContainer" cellspacing="0" cellpadding="0" border="0" class=bodygrey11space>

<TR><TD colspan='2' align='center' height=24><DIV class=linkheader2><STRONG>ตารางการสอบเค้าโครง</STRONG></DIV></TD></TR>
<!--
<TR><TD colspan='2' align='center' height=24>
<form name='display_date' action='report_examine1.php' method='post'>
<INPUT id='sel1' name='date1' class='bodygrey11space' style='width:100px;text-align:center' readonly='readonly' value='<?php echo $_POST["date1"]; ?>'><INPUT class='bodygrey11space' onclick="return showCalendar('sel1', '%Y-%m-%d', '24', true);" type="reset" value=" ... "> &nbsp;&nbsp;ถึงวันที่ &nbsp;&nbsp;
<INPUT id='sel2' name='date2' class='bodygrey11space' style='width:100px;text-align:center' readonly='readonly' value='<?php echo $_POST["date2"]; ?>'><INPUT class='bodygrey11space' onclick="return showCalendar('sel2', '%Y-%m-%d', '24', true);" type="reset" value=" ... ">
&nbsp;&nbsp;<input class='bodygrey11space' style='width:100px;text-align:center' type='submit' value='แสดงรายการ'>
</form>
</TD></TR>


<TR><TD colspan='2' align='center' height=24 class='red'>
<?php
$cant_dias = (strtotime($_POST["date2"])-strtotime($_POST["date1"]))/86400; /// หาจำนวนของช่วงเวลาที่ผู้ใช้กรอก
if($cant_dias < 0){ echo "ช่วงเวลาที่ระบุไม่ถูกต้องครับ"; }
?>
</TD></TR>
-->


<!-- Top Container (Begin) -->
<tr><td colspan="3" class="ewPadding"><div id="ewTop" class="phpreportmaker">
<!-- top slot -->
<a name="top"></a>
<?php } ?>
<div align='center' class="phpreportmaker"><b>ตารางกำหนดการสอบเค้าโครงวิทยานิพนธ์/การศึกษาอิสระ</b></div>
<?php if (@$sExport == "") { ?>
<div class="phpreportmaker">Export to
&nbsp;&nbsp;<a href="report_examine1.php?export=excel"><img src='rptimages/exportxls.gif' alt='Export to Excel' width='16' height='16' border='0'></a>
&nbsp;&nbsp;<a href="report_examine1.php?export=word"><img src='rptimages/exportdoc.gif' alt='Export to Word' width='16' height='16' border='0'></a>
</div>
<?php } ?>
<br>

<!-- Report Grid (Begin) -->
<table id="ewReport" class="ewTable" border='1' cellpadding='0' cellspacing='0' width='100%'>
<?php

// Start group <= total number of groups
if (intval($nStartGrp) > intval($nTotalGrps)) {
$nStartGrp = $nTotalGrps;
}

// Set the last group to display
$nStopGrp = $nStartGrp + $nDisplayGrps - 1;

// Stop group <= total number of groups
if (intval($nStopGrp) > intval($nTotalGrps)) {
$nStopGrp = $nTotalGrps;
}

$nRecCount = 0;
$x_FIELD_1_New = 0;
$x_FIELD_2_Old = "";
$x_Redun= false;

// Init Summary Values
ResetLevelSummary(0);

// Get First Row
if ($rscnt > 0) {
GetRow(1);
$nGrpCount = 1;
}

$x_FIELD_2_Old = "";
$x_FIELD_1_New = 0; // Record Count New
$x_KEEP_RECORD = "";
$V_Date = false;
$x_PLACE_Keep_f = "</td><td class='ewRptDtlField' align='left'>";
$x_PLACE_Keep_c = "";
?>

<tr align='center' >
<td class="ewTableHeader" width='40px' valign='top'>
ลำดับที่
</td>
<td class="ewTableHeader" width='100px' valign='top'>
วัน/เดือน/ปี<br>เวลา
</td>
<td class="ewTableHeader" width='160px' valign='top'>
ชื่อ-สกุล<br>รหัสประจำตัว
</td>
<td class="ewTableHeader" valign='top'>
ชื่อเรื่อง<br>วิทยานิพนธ์/การศึกษาอิสระ
</td>
<td class="ewTableHeader" width='160px' valign='top'>
กรรมการสอบ
</td>
<td class="ewTableHeader" valign='top'>
สถานที่สอบ
</td>
</tr>

<?php

$xxx = "";
while ($row ) {

if (intval($nGrpCount) >= intval($nStartGrp) && $nGrpCount <= $nStopGrp ) { // เริ่ม if ตัวใหญ่

//*******************************
$x_FIELD_DATE_KEEP = subStr($x_FIELD_2,0,10);
//echo $x_FIELD_DATE_KEEP . "<br>";
$x_FIELD_DATE_NEW = xfind_stamp($x_FIELD_DATE_KEEP);
//echo $x_FIELD_DATE_NEW . "<br>";
$x_FIELD_DATE_KEEP = subStr($x_FIELD_2,10,50);
$x_FIELD_DATE_NEW = $x_FIELD_DATE_NEW . $x_FIELD_DATE_KEEP;
//*******************************
//echo($x_FIELD_2 . "....." . $x_FIELD_2_Old );
//echo($x_FIELD_1_New);
$nRecCount++;
if($x_FIELD_2 != $x_FIELD_2_Old ){
$x_Redun = false;
$x_FIELD_1_New++;
$x_FIELD_2_Old = $x_FIELD_2;
}else{
$x_FIELD_2_Old = $x_FIELD_2;
}

// Set row color
$sItemRowClass = " class=\"ewTableRow\"";

// Display alternate color for rows
if ($x_FIELD_1_New % 2 <> 1) {
$sItemRowClass = " class=\"ewTableAltRow\"";
}

?>
<!-- ######################################-->
<!-- ######################################-->

<?php

if (($x_PLACE_Keep_c != "") && ($x_Redun == false) ){
echo $x_PLACE_Keep_f . $x_PLACE_Keep_c . $x_PLACE_Keep_l;
$x_PLACE_Keep_c = "";
}

if( $x_Redun == false ) {
$x_Redun = true;
if ($x_FIELD_2 == ""){
echo "<tr " . $sItemRowClass . " align='center' valign='top'><td class='ewRptDtlField'>&nbsp;</td>" ;
}else{
$xxx = "<tr " . $sItemRowClass . " align='center' valign='top'><td class='ewRptDtlField'>" . $x_FIELD_1_New ."</td>" ;
}

$xxx = $xxx . "<td class='ewRptDtlField'>" . $x_FIELD_DATE_NEW ."</td>" ; // $x_FIELD_2 วัน เดือน ปี เวลา
$xxx = $xxx . "<td class='ewRptDtlField'>" . str_replace(chr(10), "<br>", $x_FIELD_3) ."</td>" ;
$xxx = $xxx . "<td class='ewRptDtlField'>" . str_replace(chr(10), "<br>", $x_FIELD_4) ."</td>" ;
echo $xxx ;
$x_PLACE_Keep_c = $x_FIELD_5; // $x_FIELD_5 กรรมการสอบ
$x_PLACE_Keep_f = $x_PLACE_Keep_f ;

$x_PLACE_Keep_l = "</td><td class='ewRptDtlField'>";
$x_PLACE_Keep_l = $x_PLACE_Keep_l . "<div align='center'>" . $x_place_name . "</div>";
$x_PLACE_Keep_l = $x_PLACE_Keep_l . "</td>";
$x_PLACE_Keep_l = $x_PLACE_Keep_l . "</tr>";
}else{
$x_PLACE_Keep_c = $x_PLACE_Keep_c . "<br>" . $x_FIELD_5;
}

//if ( ($x_Redun == true) ) { echo $xxx ; }

?>
<!-- ######################################-->
<!-- ######################################-->
<?php

// Accumulate page summary
// AccumulateSummary();


} // จบ if ตัวใหญ่

// Accumulate grand summary
//AccumulateGrandSummary();



// Get next record
GetRow(2);
$nGrpCount++;

//*******************************
$cd_base = subStr($x_FIELD_2,0,4) . subStr($x_FIELD_2,5,2) . subStr($x_FIELD_2,8,2);
//echo $cd_base ;
if( ($cd_base >=$cd1) && ($cd_base <=$cd2 ) ){ $V_Date = true; }else{ $V_Date = false; }
//*******************************

} // End while

echo $x_PLACE_Keep_f . $x_PLACE_Keep_c . $x_PLACE_Keep_l; // เก็บตก

?>
</table>
<!-- </form> -->
</div>
<!-- Summary Report Ends -->
<?php if (@$sExport == "") { ?>
</div><br></td>
<!-- Center Container - Report (End) -->
<!-- Right Container (Begin) -->
<td valign="top"><div id="ewRight" class="phpreportmaker">
<!-- Right slot -->
</div></td>
<!-- Right Container (End) -->
</tr>
<!-- Bottom Container (Begin) -->
<tr><td colspan="3"><div id="ewBottom" class="phpreportmaker">
<!-- Bottom slot -->
</div><br></td></tr>
<!-- Bottom Container (End) -->
</table>
<!-- Table Container (End) -->
<?php } ?>
<?php
php_close($conn);
?>
<?php include "rptinc/footer.php"; ?>
<?php

// Accummulate summary
function AccumulateSummary() {
global $smry, $cnt, $col, $val, $mn, $mx;
for ($ix = 0; $ix < count($smry); $ix++) {
for ($iy = 1; $iy < count($smry[$ix]); $iy++) {
$cnt[$ix][$iy]++;
if ($col[$iy]) {
$valwrk = $val[$iy];
if ($valwrk == NULL || !is_numeric($valwrk)) {

// skip
} else {
$smry[$ix][$iy] += $valwrk;
if ($mn[$ix][$iy] == NULL) {
$mn[$ix][$iy] = $valwrk;
$mx[$ix][$iy] = $valwrk;
} else {
if ($mn[$ix][$iy] > $valwrk) $mn[$ix][$iy] = $valwrk;
if ($mx[$ix][$iy] < $valwrk) $mx[$ix][$iy] = $valwrk;
}
}
}
}
}
for ($ix = 1; $ix < count($smry); $ix++) {
$cnt[$ix][0]++;
}
}

// Reset level summary
function ResetLevelSummary($lvl) {
global $smry, $cnt, $col, $mn, $mx, $nRecCount, $grandsmry;

// Clear summary values
for ($ix = $lvl; $ix < count($smry); $ix++) {
for ($iy = 1; $iy < count($smry[$ix]); $iy++) {
$cnt[$ix][$iy] = 0;
if ($col[$iy]) {
$smry[$ix][$iy] = 0;
$mn[$ix][$iy] = NULL;
$mx[$ix][$iy] = NULL;
}
}
}
for ($ix = $lvl; $ix < count($smry); $ix++) {
$cnt[$ix][0] = 0;
}

// Clear grand summary
if ($lvl == 0) {
for ($iy = 1; $iy < count($grandsmry[$iy]); $iy++) {
if ($col[$iy]) {
$grandsmry[$iy] = 0;
$grandmn[$iy] = NULL;
$grandmx[$iy] = NULL;
}
}
}

// Clear old values
// Reset record count
//$x_FIELD_2_Old = "";
//$x_FIELD_1 = 0;
$nRecCount = 0;
}

// Accummulate grand summary
function AccumulateGrandSummary() {
global $cnt, $col, $val, $grandsmry, $grandmn, $grandmx;
@$cnt[0][0]++;
for ($iy = 1; $iy < count($grandsmry); $iy++) {
if ($col[$iy]) {
$valwrk = $val[$iy];
if ($valwrk == NULL || !is_numeric($valwrk)) {

// skip
} else {
$grandsmry[$iy] += $valwrk;
if ($grandmn[$iy] == NULL) {
$grandmn[$iy] = $valwrk;
$grandmx[$iy] = $valwrk;
} else {
if ($grandmn[$iy] > $valwrk) $grandmn[$iy] = $valwrk;
if ($grandmx[$iy] < $valwrk) $grandmx[$iy] = $valwrk;
}
}
}
}
}

// Get row values
function GetRow($opt) {
global $rs, $rsidx, $row, $val, $rscnt;
if ($rscnt == 0) return;
if ($opt == 1) { // Get first row
$row = $rs[0];
} else { // Get next row
$rsidx++;
$row = ($rsidx < $rscnt) ? $rs[$rsidx] : FALSE;
}
while ($row) {
if (ValidRow($row)) {
$GLOBALS["x_FIELD_1"] = $row["FIELD_1"];
$val[1] = $GLOBALS["x_FIELD_1"];
$GLOBALS["x_FIELD_2"] = $row["FIELD_2"];
//$GLOBALS["x_FIELD_2"] = $x_FIELD_DATE_NEW;
$val[2] = $GLOBALS["x_FIELD_2"];
$GLOBALS["x_FIELD_3"] = $row["FIELD_3"];
$val[3] = $GLOBALS["x_FIELD_3"];
$GLOBALS["x_FIELD_4"] = $row["FIELD_4"];
$val[4] = $GLOBALS["x_FIELD_4"];
$GLOBALS["x_FIELD_5"] = $row["FIELD_5"];
$val[5] = $GLOBALS["x_FIELD_5"];
$GLOBALS["x_place_name"] = $row["place_name"];
$val[6] = $GLOBALS["x_place_name"];
break;
} else {
$rsidx++;
$row = ($rsidx < $rscnt) ? $rs[$rsidx] : FALSE;
}
}
if (!$row) {
$GLOBALS["x_FIELD_1"] = "";
$GLOBALS["x_FIELD_2"] = "";
$GLOBALS["x_FIELD_3"] = "";
$GLOBALS["x_FIELD_4"] = "";
$GLOBALS["x_FIELD_5"] = "";
$GLOBALS["x_place_name"] = "";
}
}

//-------------------------------------------------------------------------------
// Function SetUpStartGroup
// - Set up Starting Record parameters based on Pager Navigation
// - Variables setup: nStartGrp

function SetUpStartGroup() {
global $PHP_SESSION, $PHP_GET;
global $nStartGrp, $nTotalGrps, $nDisplayGrps;

// Check for a START parameter
if (@$PHP_GET[EW_TABLE_START_GROUP] != "") {
$nStartGrp = $PHP_GET[EW_TABLE_START_GROUP];
$PHP_SESSION[EW_TABLE_SESSION_START_GROUP] = $nStartGrp;
} elseif (@$PHP_GET["pageno"] != "") {
$nPageNo = $PHP_GET["pageno"];
if (is_numeric($nPageNo)) {
$nStartGrp = ($nPageNo-1)*$nDisplayGrps+1;
if ($nStartGrp <= 0) {
$nStartGrp = 1;
} elseif ($nStartGrp >= intval(($nTotalGrps-1)/$nDisplayGrps)*$nDisplayGrps+1) {
$nStartGrp = intval(($nTotalGrps-1)/$nDisplayGrps)*$nDisplayGrps+1;
}
$PHP_SESSION[EW_TABLE_SESSION_START_GROUP] = $nStartGrp;
} else {
$nStartGrp = @$PHP_SESSION[EW_TABLE_SESSION_START_GROUP];
if (!is_numeric($nStartGrp) || $nStartGrp == "") {
$nStartGrp = 1; // Reset start record counter
$PHP_SESSION[EW_TABLE_SESSION_START_GROUP] = $nStartGrp;
}
}
} else {
$nStartGrp = @$PHP_SESSION[EW_TABLE_SESSION_START_GROUP];
if (!is_numeric($nStartGrp) || $nStartGrp == "") {
$nStartGrp = 1; // Reset start record counter
$PHP_SESSION[EW_TABLE_SESSION_START_GROUP] = $nStartGrp;
}
}
}

//-------------------------------------------------------------------------------
// Function ResetCmd
// - RESET: reset search parameters

function ResetCmd() {
global $PHP_SESSION, $PHP_POST, $PHP_GET;

// Skip if post back
if (count($PHP_POST) > 0) return;

// Get Reset Cmd
if (@$PHP_GET["cmd"] != "") {
$sCmd = $PHP_GET["cmd"];
if (strtolower($sCmd) == "reset") {
ResetPager();
}
}
}

// Reset pager
function ResetPager() {

// Reset Start Position (Reset Command)
global $PHP_SESSION, $nStartGrp;
$nStartGrp = 1;
$PHP_SESSION[EW_TABLE_SESSION_START_GROUP] = $nStartGrp;
}

// Set up selection
function SetupSelection() {
global $PHP_SESSION, $PHP_POST, $PHP_GET;

// Process post back form
$sName = @$PHP_POST["popup"]; // Get popup form name
$sName = (get_magic_quotes_gpc()) ? stripslashes($sName) : $sName;
if ($sName <> "") {
$arValues = @$PHP_POST["sel_" . $sName];
if (is_array($arValues)) {
if (get_magic_quotes_gpc()) array_walk($arValues, 'ew_StripSlashes');
if (trim($arValues[0]) == "") { // Select all
$PHP_SESSION["all_" . $sName] = TRUE;
array_shift($arValues); // Remove first entry
} else {
$PHP_SESSION["all_" . $sName] = FALSE;
}
$PHP_SESSION["sel_" . $sName] = $arValues;
$PHP_SESSION["rf_" . $sName] = (get_magic_quotes_gpc()) ? stripslashes(@$PHP_POST["from_" . $sName]) : @$PHP_POST["from_" . $sName];
$PHP_SESSION["rt_" . $sName] = (get_magic_quotes_gpc()) ? stripslashes(@$PHP_POST["to_" . $sName]) : @$PHP_POST["to_" . $sName];
ResetPager();
}
}

// Load selection criteria to array
}

// Initialize group data - total number of groups + grouping field arrays
function InitReportData(&$rs) {
global $conn, $nTotalGrps, $bFilterApplied;
global $EW_TABLE_SQL_WHERE, $sFilter;

// Initialize group count
$grpcnt = 0;
foreach ($rs as $row) {
$bValidRow = ValidRow($row);
if (!$bValidRow) $bFilterApplied = TRUE;

// Update group count
if ($bValidRow) $grpcnt++;
}

// Set up total number of groups
$nTotalGrps = $grpcnt;
}

// Check if row is valid
function ValidRow($row) {
$ValidRow = TRUE;
return $ValidRow;
}
?>
<?php

//-------------------------------------------------------------------------------
// Function SetUpDisplayGrps
// - Set up Number of Groups displayed per page based on Form element GrpPerPage
// - Variables setup: nDisplayGrps

function SetUpDisplayGrps() {
global $PHP_GET;
global $PHP_SESSION;
global $nDisplayGrps;
global $nStartGrp;
$sWrk = @$PHP_GET[EW_TABLE_GROUP_PER_PAGE];
if ($sWrk <> "") {
if (is_numeric($sWrk)) {
$nDisplayGrps = intval($sWrk);
} else {
if (strtoupper($sWrk) == "ALL") { // Display All Records
$nDisplayGrps = -1;
} else {
$nDisplayGrps = 500; // Non-numeric, Load Default
}
}
$PHP_SESSION[EW_TABLE_SESSION_GROUP_PER_PAGE] = $nDisplayGrps; // Save to Session

// Reset Start Position (Reset Command)
$nStartGrp = 1;
$PHP_SESSION[EW_TABLE_SESSION_START_GROUP] = $nStartGrp;
} else {
if (@$PHP_SESSION[EW_TABLE_SESSION_GROUP_PER_PAGE] <> "") {
$nDisplayGrps = $PHP_SESSION[EW_TABLE_SESSION_GROUP_PER_PAGE]; // Restore from Session
} else {
$nDisplayGrps = 500; // Load Default
}
}
}
?>
-----------------------------------------------------------------------------------------------------------------------------------------
code ของ ewconfig.php

<?php

// PHP Report Maker 1.0 - website configuration
// Database connection

define("HOST", "localhost", TRUE);
define("PORT", 3306, TRUE);
define("USER", "root", TRUE);
define("PASS", "abc123", TRUE);
define("DB", "etip", TRUE);

// Database configuration
define("EW_DBMSNAME", "MySQL", TRUE);

define("EW_DB_START_QUOTE", "`", TRUE);
define("EW_DB_END_QUOTE", "`", TRUE);
define("EW_USE_MYSQLI", FALSE, TRUE);

// Date format
define("DEFAULT_DATE_FORMAT", "yyyy/mm/dd", TRUE);
define("EW_DATE_SEPARATOR", "/", TRUE);
define("DEFAULT_CURRENCY_SYMBOL", "$", TRUE);
define("DEFAULT_MON_DECIMAL_POINT", ".", TRUE);
define("DEFAULT_MON_THOUSANDS_SEP", ",", TRUE);
define("DEFAULT_POSITIVE_SIGN", "", TRUE);
define("DEFAULT_NEGATIVE_SIGN", "-", TRUE);
define("DEFAULT_FRAC_DIGITS", 2, TRUE);
define("DEFAULT_P_CS_PRECEDES", TRUE, TRUE);
define("DEFAULT_P_SEP_BY_SPACE", FALSE, TRUE);
define("DEFAULT_N_CS_PRECEDES", TRUE, TRUE);
define("DEFAULT_N_SEP_BY_SPACE", FALSE, TRUE);
define("DEFAULT_P_SIGN_POSN", 3, TRUE);
define("DEFAULT_N_SIGN_POSN", 3, TRUE);

// Filter label
define("EW_NULL_LABEL", "(Null)", TRUE);
define("EW_EMPTY_LABEL", "(Empty)", TRUE);

// Project config
define("EW_PROJECT_NAME", "etip", TRUE); // Project Name
define("EW_PROJECT_VAR", "etip", TRUE); // Project Var

// Session names
define("EW_SESSION_STATUS", EW_PROJECT_VAR . "_status", TRUE); // Login Status
define("EW_SESSION_USERNAME", EW_SESSION_STATUS . "_UserName", TRUE); // User Name
define("EW_SESSION_USERID", EW_SESSION_STATUS . "_UserID", TRUE); // User ID
define("EW_SESSION_USERLEVEL", EW_SESSION_STATUS . "_UserLevel", TRUE); // User Level
define("EW_SESSION_PARENT_USERID", EW_SESSION_STATUS . "_ParentUserID", TRUE); // Parent User ID
define("EW_SESSION_SYSTEM_ADMIN", EW_PROJECT_VAR . "_SysAdmin", TRUE); // System Admin
define("EW_SESSION_MESSAGE", EW_PROJECT_VAR . "_Message", TRUE); // System Message

// Hard-coded admin
define("EW_ADMIN_USERNAME", "wss", TRUE);
define("EW_ADMIN_PASSWORD", "ss", TRUE);

// User admin
define("EW_USERNAME_FIELD", "std_id", TRUE);
define("EW_PASSWORD_FIELD", "std_id", TRUE);
define("EW_USERID_FIELD", "", TRUE);
define("EW_PARENT_USERID_FIELD", "", TRUE);
define("EW_USERLEVEL_ARRAY_FIELD", "", TRUE);
define("EW_LOGIN_SELECT_SQL", "SELECT * FROM `etp_student`", TRUE);

// Cookie names
define("EW_COOKIE_AUTOLOGIN", EW_PROJECT_VAR . "_autologin", TRUE); // Auto Login
define("EW_COOKIE_USERNAME", EW_PROJECT_VAR . "_username", TRUE); // Auto Login User Name
define("EW_COOKIE_PASSWORD", EW_PROJECT_VAR . "_password", TRUE);; // Auto Login Password

// Random key for encryption
define("EW_RANDOM_KEY", "&30sl84YY_g_RvSC", TRUE);

// Chart data encoding
// Note: If you use non English languages, you need to set the encoding for
// charting. Make sure your encoding is supported by your PHP and either
// iconv functions or multibyte string functions are enabled. See PHP manual
// for details
// eg. define("EW_ENCODING", "ISO-8859-1", true);

define("EW_ENCODING", "utf8", true); // enter your encoding here

define('ADODB_ASSOC_CASE',0); //lower
define('ADODB_FORCE_NULLS',1);

$libdir='c:/AppServ/www/etip/';

include_once($libdir.'include/adodb.inc.php');
include_once($libdir.'include/adodb-pager.inc.php');
include_once($libdir.'include/adodb-time.inc.php');
include_once($libdir.'include/tohtml.inc.php');

$database = NewADOConnection('mysql');
$database->Connect(HOST,USER,PASS,DB);

?>
-------------------------------------------------------------------------------------------------------------------------------------

ช่วยลูกนกลูกกาด้วยนะครับหมดปัญญาจริงๆ
อยากได้รายละเอียดมากกว่านี้วานพี่ๆทิ้งเมล์ใว้ให้ผมก็ได้ครับ ขอบคุณล่วงหน้านะครับ



Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-02-25 15:12:33 By : nantasit View : 1799 Reply : 2
 

 

No. 1



โพสกระทู้ ( 1,751 )
บทความ ( 0 )



สถานะออฟไลน์


ยาวมากครับ ทำไม่ไม่ใส Php code คุมจะได้เห็นบรรทัดครับ แบบนี้ตาลายมากๆๆๆครับ






Date : 2010-02-25 15:24:32 By : SOUL
 


 

No. 2



โพสกระทู้ ( 12 )
บทความ ( 0 )



สถานะออฟไลน์


พอดีได้ code มาครับ

แล้วเพิ่งหัดทำด้วย เจอดีเลยครับ error เพียบ พี่ๆที่เทพๆช่วยทีนะครับ เอาบุญครับ
ทิ้งเมล์ไว้ก็ได้ครับ
Date : 2010-02-25 15:34:53 By : nantasit
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : วานพี่ๆสมาชิกชวนแก้ปัญหา code php นี้ให้ด้วยครับ พอดี ว่าจะทำเป็นโปรเจ๊คนะครับเพิ่งเริ่มหัดทำ php ได้
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2025 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่