php - HTTP Error 500 (Internal Server Error) in Drupal -
iam providing datas using json ios app using php. while running code in browser, showing server error. if there no values in database, shows {"posts":null}
provided in code. problem occurs if there value in database. shows error
server error website encountered error while retrieving http://path server file/php/categoryitemlisting.php?category=11. may down maintenance or configured incorrectly. here suggestions: reload webpage later. http error 500 (internal server error): unexpected condition encountered while server attempting fulfill request.
error occuring php file. using other files, able transfer data.
my connection.php file :
<?php $link = mysql_connect("127.0.0.1","root","") or die('cannot connect db'); mysql_set_charset("utf8"); mysql_select_db('cotton',$link) or die('cannot select db'); ?>
categoryitemlisting.php
<?php require('connection.php'); $item = array() ; /* connect db */ if(isset($_request['category'])) { $k=$_request['category']; /* grab posts db */ // $k=11; $catid = mysql_query("select entity_id field_data_field_cat field_cat_tid= $k"); while($r = mysql_fetch_assoc($catid)) { $category[] = $r['entity_id']; foreach ( $category $cat ); { $data= mysql_query("select field_data_field_name.entity_id, field_data_field_name.field_name_value, file_managed.uri, field_data_field_sec.field_sec_tid file_managed inner join ( field_data_field_thumb, field_data_field_name, field_data_field_sec ) on ( file_managed.fid = field_data_field_thumb.field_thumb_fid , field_data_field_name.entity_id = field_data_field_thumb.entity_id , field_data_field_thumb.entity_id = field_data_field_sec.entity_id ) field_data_field_name.entity_id = $cat"); $items = mysql_fetch_assoc($data); $item[]= $items; } } $re="public:\/\/"; $list = json_encode(array('posts'=>$item)); $list = str_replace( $re, "http://localhost/sites/default/files/" ,$list); echo $list; @mysql_close($link); } else { echo "connection failed"; } ?>
how can values fixing error? dont think problem of server. if there other mistakes in code ?
look yout php.ini , set:
display_errors = on
error_reporting = e_all
if display_error off , have type of problem code (e.g.: parse error) response 500 status page.
Comments
Post a Comment