0

嗨,我正在使用 zen cart 并拥有此代码,我不断收到 500 内部服务器错误,我不确定它是代码还是我的 php 脚本中的某些内容:

<?php
global $db

$partNum = trim(strtolower($_POST['partNum']));
$partNum = mysql_escape_string($partNum);

$query = "SELECT products_model FROM " . TABLE_PRODUCTS . " WHERE products_model = '$partNum' LIMIT 1";
$result = $db->Execute($query);
$num = mysql_num_rows($result);

echo $num;
mysql_close();

和jQuery

jQuery.ajax({
   type: "POST",
   url: "/includes/templates/theme376/phpScripts/check.php",
   data: 'partNum='+ partNum,
   cache: false,
   success: function(response){
if(response == 1){
$('#partNum').css('border', '3px #C33 solid');  
$('#tick').hide();
$('#cross').fadeIn();
}else{
$('#partNum').css('border', '3px #090 solid');
$('#cross').hide();
$('#tick').fadeIn();
     }

}
});

这是错误

POST http://mysite.com/includes/templates/theme376/phpScripts/check.php?partNum=wwww 500 (Internal Server Error) /min/?f=/includes/templates/theme376/jscript/jscript_fileuploader.js,/includes/templates/theme376/jscript/jscript_jquery-1.7.1.min.js,/includes/templates/theme376/jscript/jscript_jquery-ui-1.8.20.custom.min.js,/includes/templates/theme376/jscript/jscript_jquery.nivo.slider.pack.js&1332216833:38
f.support.ajax.f.ajaxTransport.send /min/?f=/includes/templates/theme376/jscript/jscript_fileuploader.js,/includes/templates/theme376/jscript/jscript_jquery-1.7.1.min.js,/includes/templates/theme376/jscript/jscript_jquery-ui-1.8.20.custom.min.js,/includes/templates/theme376/jscript/jscript_jquery.nivo.slider.pack.js&1332216833:38
f.extend.ajax /min/?f=/includes/templates/theme376/jscript/jscript_fileuploader.js,/includes/templates/theme376/jscript/jscript_jquery-1.7.1.min.js,/includes/templates/theme376/jscript/jscript_jquery-ui-1.8.20.custom.min.js,/includes/templates/theme376/jscript/jscript_jquery.nivo.slider.pack.js&1332216833:38
partNum_check index.php:307
f.event.dispatch /min/?f=/includes/templates/theme376/jscript/jscript_fileuploader.js,/includes/templates/theme376/jscript/jscript_jquery-1.7.1.min.js,/includes/templates/theme376/jscript/jscript_jquery-ui-1.8.20.custom.min.js,/includes/templates/theme376/jscript/jscript_jquery.nivo.slider.pack.js&1332216833:37
f.event.add.h.handle.i
4

1 回答 1

0

从数据中取出partnum 并将其用作查询字符串。

你只是得到一个通用的 500 错误?没有细节?

如果将 ?partnum=blah 放入请求 URL 会发生什么?

我不确定您是否希望像这样在“数据”中使用查询参数。这适用于数据,而不是查询字符串。

于 2012-06-08T20:52:48.313 回答