run แล้ว Error ช่วยเหลือคนแก่ที่กำลังจะเจอเด็กตบหน่อยครับ
Code (PHP)
<!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=windows-874" />
<title>Untitled Document</title>
</head>
<body>
<?
{
if(trim($_FILES["doc_LINK"]["tmp_name"]) != "")
{
copy($_FILES["doc_LINK"]["tmp_name"],"MyResize/".$_FILES["doc_LINK"]["name"]);
}
$insertSQL = sprintf("INSERT INTO m_document (doc_ID, doc_TYPE, doc_NAME, doc_LINK) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['doc_ID'], "int"),
GetSQLValueString($_POST['doc_TYPE'], "text"),
GetSQLValueString($_POST['doc_NAME'], "text"),
GetSQLValueString($_FILES['doc_LINK']["name"], "text"));
//GetSQLValueString($_POST['text_comment'], "text"),
//GetSQLValueString($_FILES["update_upload"]["name"], "text"));
mysql_select_db($database_AssetDB, $AssetDB);
$Result2= mysql_query($insertSQL, $AssetDB) or die(mysql_error());
?><META HTTP-EQUIV="Refresh" CONTENT="1200;"><?
}
if($doc_ID != ""){
$objDB = mysql_select_db("AssetDB");
$strSQL = "SELECT * FROM m_document WHERE doc_ID=".$doc_ID."";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
}
/*if($jobno != ""){
$objDB = mysql_select_db("AssetDB");
$strSQL = "SELECT * FROM topic_comment WHERE reports_ID=".$jobno."";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
}*/
$Per_Page = 100; // Per Page
$Page = $_GET["Page"];
if(!$_GET["Page"])
{
$Page=1;
}
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}
$strSQL .=" order by doc_ID ASC LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_query($strSQL);
if($reports_ID != ""){
$strSQL1 = "SELECT * FROM m_document WHERE doc_ID=".$doc_ID."";
$objQuery1 = mysql_query($strSQL1) or die ("Error Query [".$strSQL1."]");
$Num_Rows1 = mysql_num_rows($objQuery1);
while($objResult1 = mysql_fetch_array($objQuery1))
{
$doc_ID = $objResult1["doc_ID"];
$header = $objResult1["doc_NAME"];
} }
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="84%" height="100"><table width="96%" border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF">
<tr>
<th width="10%" bgcolor="#66CCFF" class="zagol style1"> <div align="center" class="style6">Creator</div></th>
<th width="10%" bgcolor="#66CCFF" class="zagol style1"> <div align="center" class="style6">Work Date </div></th>
<th width="70%" bgcolor="#66CCFF" class="zagol style1"> <div align="center" class="style6">Comment</div></th>
<th width="10%" bgcolor="#66CCFF" class="zagol style1"> <div align="center" class="style6">Link</div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td bgcolor="#CCCCCC" height="60"><div align="center"><span class=content>
<?=$objResult["doc_ID"];?>
</span></div></td>
<td bgcolor="#CCCCCC" height="60"><div align="center"><span class=content>
<?=$objResult["doc_TYPE"];?>
</span></div></td>
<td bgcolor="#CCCCCC" height="60"><div align="center"><span class="content">
<?=$objResult["doc_NAME"];?>
</span></div></td>
<td bgcolor="#CCCCCC" height="60"><div align="center"><span class=content>
<? if($objResult["doc_LINK"] != "")
{ ?>
<br><a href="<?="MyResize/".$objResult["doc_LINK"]; ?>"><img src="image/Attack.gif" border="0" class="link"><br><?=$objResult["doc_LINK"];?></a>
<? } ?>
</span></div></td>
</tr>
<?
}
?>
</body>
</html>
run แล้ว Error Fatal error: Call to undefined function: getsqlvaluestring() in c:\appserv\www\assetdb\testtt.php on line 19
อ่ะครับ ไม่รู้ว่าผิดตรงไหน รบกวนหน่อยนะครับTag : - - - -
Date :
2010-02-13 17:45:58
By :
slam
View :
934
Reply :
2
Code (PHP)
<?php require_once('Connections/AssetDB.php'); ?>
<?php require_once('Connections/AssetDB.php'); ?>
<?php
if($HTTP_COOKIE_VARS["user"]=="")
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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_AssetDB, $AssetDB);
$query_Q_Status = "SELECT * FROM m_status";
$Q_Status = mysql_query($query_Q_Status, $AssetDB) or die(mysql_error());
$row_Q_Status = mysql_fetch_assoc($Q_Status);
$totalRows_Q_Status = mysql_num_rows($Q_Status);
mysql_select_db($database_AssetDB, $AssetDB);
$query_Q_Response = "SELECT * FROM m_response";
$Q_Response = mysql_query($query_Q_Response, $AssetDB) or die(mysql_error());
$row_Q_Response = mysql_fetch_assoc($Q_Response);
$totalRows_Q_Response = mysql_num_rows($Q_Response);
mysql_select_db($database_AssetDB, $AssetDB);
$query_Q_Type = "SELECT * FROM m_type";
$Q_Type = mysql_query($query_Q_Type, $AssetDB) or die(mysql_error());
$row_Q_Type = mysql_fetch_assoc($Q_Type);
$totalRows_Q_Type = mysql_num_rows($Q_Type);
mysql_select_db($database_AssetDB, $AssetDB);
$query_Q_location = "SELECT * FROM m_location";
$Q_location = mysql_query($query_Q_location, $AssetDB) or die(mysql_error());
$row_Q_location = mysql_fetch_assoc($Q_location);
$totalRows_Q_location = mysql_num_rows($Q_location);
mysql_select_db($database_AssetDB, $AssetDB);
$query_Q_system = "SELECT * FROM m_system";
$Q_system = mysql_query($query_Q_system, $AssetDB) or die(mysql_error());
$row_Q_system = mysql_fetch_assoc($Q_system);
$totalRows_Q_system = mysql_num_rows($Q_system);
$queryString_Total_Report = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Total_Report") == false &&
stristr($param, "totalRows_Total_Report") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Total_Report = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Total_Report = sprintf("&totalRows_Total_Report=%d%s", $totalRows_Total_Report, $queryString_Total_Report);
?>
<HTML>
<HEAD>
<link title="web templates" href="http://templatemonster.com" type="text/html"><link title="custom web design" href="http://inverse-logic.com" type="text/html">
<TITLE>Web Daily Report</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-874">
<link rel="stylesheet" href="site.css" type="text/css">
<style type="text/css">
<!--
.style1 {
font-size: 14px;
font-weight: bold;
}
body {
background-color: #FFFFFF;
}
.style6 {color: #FFFFFF}
.style7 {
color: #0000FF;
font-size: 18px;
font-weight: bold;
}
.style14 {color: #003399}
.style16 {
color: #FF0000;
font-size: 14px;
font-weight: bold;
}
-->
</style>
<script>
function show_text(obj)
{
if(obj.checked)
{
document.getElementById("type1").style.display="";
}
else
{
document.getElementById("type1").style.display="none";
}
}
</script>
</HEAD>
<BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<script type='text/javascript'>
//HV Menu- by Ger Versluis (http://www.burmees.nl/)
//Submitted to Dynamic Drive (http://www.dynamicdrive.com)
//Visit http://www.dynamicdrive.com for this script and more
function Go(){return}
</script>
<script type='text/javascript' src='exmplmenu_var2.js'></script>
<script type='text/javascript' src='menu_com.js'></script>
<p class="mainmenu"><noscript></noscript></p>
<table width="99%" height="614" border="0" align="center">
<tr>
<td width="100%" height="20"> </td>
</tr>
<tr>
<td height="150" background="image/collage.gif"></td>
</tr>
<tr>
<td height="369"><table width="100%" height="280" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
<tr>
<td height="253"><p align="center">
<?
{
if(trim($_FILES["doc_LINK"]["tmp_name"]) != "")
{
copy($_FILES["doc_LINK"]["tmp_name"],"MyResize/".$_FILES["doc_LINK"]["name"]);
}
$insertSQL = sprintf("INSERT INTO m_document (doc_ID, doc_TYPE, doc_NAME, doc_LINK) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['doc_ID'], "int"),
GetSQLValueString($_POST['doc_TYPE'], "text"),
GetSQLValueString($_POST['doc_NAME'], "text"),
GetSQLValueString($_FILES['doc_LINK']["name"], "text"));
//GetSQLValueString($_POST['text_comment'], "text"),
//GetSQLValueString($_FILES["update_upload"]["name"], "text"));
mysql_select_db($database_AssetDB, $AssetDB);
$Result2= mysql_query($insertSQL, $AssetDB) or die(mysql_error());
?><META HTTP-EQUIV="Refresh" CONTENT="1200;"><?
}
if($doc_ID != ""){
$objDB = mysql_select_db("AssetDB");
$strSQL = "SELECT * FROM m_document WHERE doc_ID=".$doc_ID."";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
}
$Per_Page = 100; // Per Page
$Page = $_GET["Page"];
if(!$_GET["Page"])
{
$Page=1;
}
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}
$strSQL .=" order by doc_ID ASC LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_query($strSQL);
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="84%" height="100"><table width="96%" border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF">
<tr>
<th width="10%" bgcolor="#66CCFF" class="zagol style1"> <div align="center" class="style6">Creator</div></th>
<th width="10%" bgcolor="#66CCFF" class="zagol style1"> <div align="center" class="style6">Work Date </div></th>
<th width="70%" bgcolor="#66CCFF" class="zagol style1"> <div align="center" class="style6">Comment</div></th>
<th width="10%" bgcolor="#66CCFF" class="zagol style1"> <div align="center" class="style6">Link</div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td bgcolor="#CCCCCC" height="60"><div align="center"><span class=content>
<?=$objResult["doc_ID"];?>
</span></div></td>
<td bgcolor="#CCCCCC" height="60"><div align="center"><span class=content>
<?=$objResult["doc_TYPE"];?>
</span></div></td>
<td bgcolor="#CCCCCC" height="60"><div align="center"><span class="content">
<?=$objResult["doc_NAME"];?>
</span></div></td>
<td bgcolor="#CCCCCC" height="60"><div align="center"><span class=content>
<? if($objResult["doc_LINK"] != "")
{ ?>
<br><a href="<?="MyResize/".$objResult["doc_LINK"]; ?>"><img src="image/Attack.gif" border="0" class="link"><br><?=$objResult["doc_LINK"];?></a>
<? } ?>
</span></div></td>
</tr>
<?
}
?>
</table></td>
</tr>
</table>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1" enctype="multipart/form-data">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Doc_TYPE:</td>
<td><select name="doc_TYPE">
<?php
do {
?><option value="<?php echo $row_Q_system['M_System_Name']?>"><?php echo $row_Q_system['M_System_Name']?></option>
<?php
} while ($row_Q_system = mysql_fetch_assoc($Q_system));
$rows = mysql_num_rows($Q_system);
if($rows > 0) {
mysql_data_seek($Q_system, 0);
$row_Q_system = mysql_fetch_assoc($Q_system);
}
?>
</select>
</td>
</tr>
<tr> </tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Doc_NAME:</td>
<td><input type="text" name="doc_NAME" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Doc_LINK:</td>
<td><input type="file" name="doc_LINK" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input name="insert" type="submit" id="insert" value="Insert record" /></td>
</tr>
</table>
<p> </p>
<p>
<input type="hidden" name="doc_ID" value="" />
<input type="hidden" name="MM_insert" value="form1" />
</p>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
<a href="http://templatemonster.com"></a><a href="http://inverse-logic.com"></a>
</BODY>
</HTML>
<?php
mysql_free_result($Q_Status);
mysql_free_result($Q_Response);
mysql_free_result($Q_Type);
mysql_free_result($Q_location);
mysql_free_result($Q_system);
?>
รบกวนอีกทีครับ ขอบคุณมากๆ ครับ
run error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\appserv\www\assetdb\r_doc2.php on line 221
Date :
2010-02-13 18:08:31
By :
slam
Load balance : Server 01