Previously I use the PHP file from my own hosting, but the problem occurred when I moved to my client's (GoDaddy).
I have two inputs - Automotive and Education (I have more but for this question, I just use two as example)
In my own, both input will print the output without problem. But in GoDaddy, only Education can produce output, while Automotive produce blank page. So I add this code:
echo '<pre>';
print_r($res);
echo '</pre>';
For input Automotive, I got:
<pre>mysqli_result Object
(
[current_field] => 0
[field_count] => 1
[lengths] =>
[num_rows] => 9
[type] => 0
)
</pre>
For input Edication, I got:
<pre>mysqli_result Object
(
[current_field] => 0
[field_count] => 1
[lengths] =>
[num_rows] => 4
[type] => 0
)
</pre>
[{"subcategory":"Adult & Continuing Education"},{"subcategory":"Early Childhood Education"},{"subcategory":"Educational Resources"},{"subcategory":"Other Educational"}]
What I have done so far:
- Check the query - No problem. The query return the desired result in phpmyadmin
- Increase memory limit - Done but in PHP setting, still stated as Default even after refresh the Dedicated IIS Application Pool
- I have other input with its output/num rows more than 9 but it return the result without problem
PHP code:
<?php
if($_SERVER['REQUEST_METHOD']=='GET') {
require_once('dbConnect.php');
$category = $_GET['category'];
$sql = "SELECT subcategory FROM wg_categories WHERE category = '$category'";
$res = mysqli_query($con,$sql);
$result = array();
while($row = mysqli_fetch_array($res)){
array_push($result,
array('subcategory'=>$row[0]
));
}
echo json_encode($result);
mysqli_close($con);
}
?>
Is there something I have missed?
error_reporting - E_ALL display_errors - on log_errors - on