I want to retrieve data from the hosting but it returns me a HTTP error 500 when I tried to test my php.
This is my php code:
/**
* 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:
<?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;
}
?>