简体   繁体   English

PHP收到HTTP错误500

[英]PHP getting HTTP error 500

I want to retrieve data from the hosting but it returns me a HTTP error 500 when I tried to test my php. 我想从托管中检索数据,但是当我尝试测试php时,它返回了HTTP错误500。

This is my php code: 这是我的PHP代码:

 /**
 * Getting all stock
 */
public function getstockdesc() {
    $con = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD,DB_DATABASE);
    $result = mysqli_query($con,"select * FROM stockdesc");
    return $result;
}

This is the for sync into android sqllite: 这是用于同步到android sqllite的:

<?php

include_once 'db_functions.php';
$db = new DB_Functions();
$stockdesc = $db->getstockdesc();
$a = array();
$b = array();
if($stockdesc != false){
    while($row = mysql_fetch_array($stockdesc)){
        $b["stockdescId"] = $row["stockdescId"];
        $b["stockdesc"] = $row["stockdesc"];
        $b["itemCode"] = $row["itemCode"];
        array_push($a,$b);
    }
    echo json_encode($a);
         return $b;
}
    else{
         return false;
    }
  ?>

HOLY MOLY, I got the answers right now thx. 圣莫莉,我现在得到答案了。

Recently using: 最近使用:

mysql_fetch_array() mysql_fetch_array()

Need to change to 需要更改为

mysqli_fetch_array() mysqli_fetch_array()

My bad not paying attention! 我不好不注意!

Thanks Nipun Tyagi for finding my typo :D! 感谢Nipun Tyagi找到我的错字:D!

Use the following to see the actual error: 使用以下命令查看实际错误:

error_reporting(E_ALL);
ini_set('display_errors', 1);

Place it in the beginning of the code ;) 将其放在代码的开头;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM