Farooq Farooq - 3 months ago 19
MySQL Question

Mysql query is working in SQLyog while not read by browser

what is error in this code at mysql query???
i think it is very easy question but error could not found :( while this mysql query is working in SQLYog

$result =mysql_query(SELECT NUMPOINTS((i.geom))COUNT FROM district i WHERE district_name="D.G.KHAN";)


compete code is


//$type="R";
$result =mysql_query(SELECT NUMPOINTS((i.geom))COUNT FROM district i WHERE district_name="D.G.KHAN";)
$row2 = mysql_fetch_array($result);
$count=$row2['count'];
$x_points = array();
$y_points = array();
/* $row1 ['color']="00000"; */
for($c=1;$c<=$count;$c++){
$res=mysql_query("SELECT district_name,X ( POINTN ( i.geom ,$c))xx ,Y( POINTN ( i.geom ,$c))yy ,color FROM district i where dis_id='".$id."'" );
while($row1 = mysql_fetch_array($res)){
array_push($x_points['xx']);
array_push($y_points['yy']);
}
}

print_r ($x_points);
print_r ($y_points);


?>

Answer

You need to add as a string:

$result =mysql_query("SELECT NUMPOINTS((i.geom)) FROM district i WHERE district_name='D.G.KHAN'";)