作者:牛尾巴2010 | 2023-08-31 13:53
我有一个AJAX应用程序的以下部分,它没有错误,但屏幕上也没有显示任何内容,所以我不确定问题所在.直接从具有?cmd&id = 1的浏览器调用此页面应该返回,或者甚至在没有?cmd的情况下调用它应该返回cmd错误消息.
编辑:添加测试用例:我确实得到了cmd错误消息,但是当我传递&id = 1(1是一个有效的id)时,没有返回任何html,查看源是完全空白的.我是否错误地使用了回声或类似的东西?
edit2:将echo添加为第一行:无法看到第一个echo
edit3:在回到旧版本并再次进行所有更改之后,我现在在使用有效的cmd和id参数调用时获得测试字符集输出.我使用的代码与下面粘贴的代码相同.
代码:
query("SET NAMES 'utf8'");
$con->set_charset("utf8"));
echo "test charset";
if($cmd=="GetSALEData")
{
echo "test cmdifloop";
if ($getRecords = $con->prepare("SELECT * FROM SALES WHERE PRODUCT_NO = ?"))
{
echo "test recordifloop";
$getHtml = $con->prepare("SELECT PRODUCT_DESC FROM SALES WHERE PRODUCT_NO = ?");
$getHtml->bind_param("s", $id);
$getHtml->execute();
$getHtml->bind_result($PRODUCT_DESC);
$getRecords->bind_param("s", $id);
$getRecords->execute();
$getRecords->bind_result($PRODUCT_NO, $PRODUCT_NAME, $SUBTITLE, $CURRENT_PRICE, $START_PRICE,
$PRICE_COUNT, $QUANT_TOTAL, $QUANT_SOLD, $ACCESSSTARTS, $ACCESSENDS,
$ACCESSORIGIN_END, $USERNAME, $BEST_PRICEDER_ID, $FINISHED, $WATCH,
$BUYITNOW_PRICE, $PIC_URL, $PRIVATE_SALE, $SALE_TYPE, $ACCESSINSERT_DATE,
$ACCESSUPDATE_DATE, $CAT_DESC, $CAT_PATH, $COUNTRYCODE, $LOCATION,
$CONDITIONS, $REVISED, $PAYPAL_ACCEPT, $PRE_TERMINATED, $SHIPPING_TO,
$FEE_INSERTION, $FEE_FINAL, $FEE_LISTING, $PIC_XXL, $PIC_DIASHOW,
$PIC_COUNT, $ITEM_SITE_ID
);
while ($getRecords->fetch())
{
$ccodes = array( "1" => "USA",
"77" => "Germany",
"16" => "Austria",
"122" => "Luxemburg",
"193" => "Switzerland",
);
$conditions = array( "0" => "USA",
"77" => "Germany",
"16" => "Austria",
);
$country = $ccodes[$COUNTRYCODE];
if ( $country == "" ) $country = "Not applicable";
$columns = array('FINISHED', 'WATCH', 'PRIVATE_SALE', 'REVISED', 'PAYPAL_ACCEPT', 'PRE_TERMINATED', 'PIC_XXL', 'PIC_DIASHOW');
foreach($columns as $column) {
$$column = $row[$column] ? 'YES' : 'NO';
}
imageResize($PIC_URL, 250, 300);
file_put_contents($id, file_get_contents($PIC_URL));
$html = htmlentities(json_encode($PRODUCT_DESC));
$shortDate = strftime("%d %m %Y", strtotime($ACCESSSTARTS));
echo "".$PRODUCT_NAME."
Username: ".$USERNAME."
PRODUCT Number: ".$PRODUCT_NO."
Subtitle: ".$SUBTITLE."
SALE Start: ".$ACCESSSTARTS."
SALE End: ".$ACCESSENDS."
SALE Type: ".$SALE_TYPE."
Category: ".$CAT_DESC."
Condition: ".$CURRENT_PRICE."
Total Items: ".$QUANT_TOTAL."
Total Sales: ".$QUANT_SOLD."
Start Price: € ".$START_PRICE."
Buyitnow Price: € ".$BUYITNOW_PRICE."
PRICEs: ".$PRICE_COUNT."
Revised: ".$REVISED."
Private: ".$PRIVATE_SALE."
Finished: ".$FINISHED."
Cancelled: ".$PRE_TERMINATED."
Paypal: ".$PAYPAL_ACCEPT."
Country: ". $country ."
Location: ".$LOCATION."
Shipping to: ". $country ."