retrieve data from database using php to android -
i have 3 major tables in database, called place, guideinfo , city. enter city name using android app, , there cityid associated city name. each 3 tables have cityid column.
below php:
<?php $con=new mysqli("dsfsdf","fsfs","wpraneet","a1575184_touri"); $city=$_post['city']; if($con->connect_error){ die( "failed connect mysql"); } //$sql1="select * //from place, guideinfo, city //where place.city_cityid = city.cityid //and city.cityid = guideinfo.city_cityid //and place.city_cityid = guideinfo.city_cityid //and cityname = '".$city."' //limit 4;"; $sql1="select * place join guideinfo b on a.city_cityid = b.city_cityid join city c on a.city_cityid = c.cityid cityname = '".$city."' limit 4;"; $result1 = $con->query ($sql1); if ($result1-> num_rows> 0) { //output data of each row while($row1 = $result1->fetch_assoc()) { echo $row1['placename']; echo "_"; echo $row1['placetype']; echo "_"; echo $row1['lat']; echo "_"; echo $row1['lng']; echo "_"; echo $row1['shtdes']; echo "_"; echo $row1['gid']; echo "_"; echo $row1['gname']; echo "_"; echo $row1['category']; echo "_"; echo $row1['telephoneno']; echo "_"; } } $con->close(); ?> in app want retrieve data four places , four guides in city has been entered , using google maps, mark 4 places.
i have used 2 queries , both mentioned in code. question when there 1 tuple in guideinfo table relevant city entered, map show 4 markers on map.
but if there 2 tuples in guideinfo table relevant city, map show two markers.
i want show four markers , details of 4 guides.
i think there must error in mysql query; should change?
i have trouble following description of problem.
can tell me more specific how expected result looks like? don't see how want details of 4 guides when 2 available.
Comments
Post a Comment