错误#1132:突然无效的JSON解析输入

时间:2016-02-08 00:42:14

标签: php json

我的应用程序工作正常,但现在,我不知道为什么,但是从我的php加载我的产品数组时出现此错误:

#1132: Invalid JSON parse input.

这里是错误的一行:

 for(var i:int = 0, l:int = products.length - 1; l >= 0; i++, l--){

我没有改变任何事情,昨天一切正常。

那可能是什么问题?

编辑

我想知道我的php文件是否在我的webbrowser中加载,我收到了这条消息:

<br />
<b>Deprecated</b>:  mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in <b>/home/brousseelf/www/sondage/convertXML.php</b> on line <b>4</b><br />
<br />
<b>Deprecated</b>:  Function mysql_numrows() is deprecated in <b>/home/brousseelf/www/sondage/convertXML.php</b> on line <b>24</b><br />
[]

所以我的代码已被弃用了?

我更新了我的sqli代码。这就是我的所作所为:

 <?php
 $categorie = $_POST['categorie'];
 $con = mysqli_connect("mysql51-103.**", "****", "***","***");
 // Check connection
 if (mysqli_connect_errno())
   {
   echo "Failed to connect to MySQL: " . mysqli_connect_error();
   }

// Perform queries 
mysqli_query($con,"SELECT * FROM annonces where categorie = '$categorie'");
$sql="SELECT * FROM annonces where categorie = '$categorie'";

header('Content-type: application/json');
$ts = gmdate("D, d M Y H:i:s") . " GMT";
header("Expires: $ts");
header("Last-Modified: $ts");
header("Pragma: no-cache");
header("Cache-Control: no-cache, must-revalidate");

// get number of rows in $result.

if ($result=mysqli_query($con,$sql))
  {
  // Return the number of rows in result set
  $rowcount=mysqli_num_rows($result);
  printf("Result set has %d rows.\n",$rowcount);
  // Free result set
  mysqli_free_result($result);
  }
$phptheTitle = "";
$products = array();

while ($row = mysqli_fetch_array($result,MYSQLI_ASSOC)) {
    $products[] = array(
        "title" => $row["theTitle"],
        "prix" => $row["prix"],
        "theDescription" => $row["theDescription"],
        "mail" => $row["mail"],
        "phone" => $row["phone"],
        "linkImg" => $row["linkImg"],
        "linkImg2" => $row["linkImg2"],
        "dateFR" => $row["dateFR"],
        "date"=> $row["date"]
    );
} 



mysqli_close($con);
 ?> 

我现在遇到此错误:Couldn't fetch mysqli_result

0 个答案:

没有答案