<?php define('host','host'); define('user','user name'); define('pass','password'); define('db','db name'); $con = mysqli_connect(host,user,pass,db); $sql = "select * toursit_guide cat='amusement parks'"; $result = mysqli_query($con,$sql); $json = array(); if($rowcount=mysqli_num_rows($result)) { echo $rowcount; while($row=mysqli_fetch_assoc($result)) { $json['tourist_guide'][]=$row; } } mysqli_close($con); echo json_encode($json,json_partial_output_on_error); ?>
this code worked fine in hostinger, when migrate godaddy isn't working (getting no output)
this code working fine godaddy:
<?php define('host','hostname'); define('user','username'); define('pass','password'); define('db','db_name'); $con = mysqli_connect(host,user,pass,db); $sql = "select * vg_main"; $res = mysqli_query($con,$sql); $result = array(); while($row = mysqli_fetch_array($res)) { array_push($result, array('id'=>$row[0], 'cat_name'=>$row[1], 'sub_cat_name'=>$row[2], 'name'=>$row[3], 'icon'=>$row[4], 'description'=>$row[5], 'lat'=>$row[6], 'lon'=>$row[7], 'contact_no'=>$row[8], 'email_id'=>$row[9], 'website'=>$row[10], 'open_time'=>$row[12], 'address'=>$row[13], 'image'=>$row[14] )); } echo json_encode(array("output"=>$result)); mysqli_close($con); ?>
i want mysqli_fetch_assoc()
many files written assoc.
Comments
Post a Comment