how I can show position of an object ( a mark) which have coordinate on database with PHP


I have a database and there is writing point numbers, x and y pixsel coordinates. I want to show that points on webpage. I can show only one point (last one).

How I can show all of them on webpage in sametime?

can anyone help me? where is the my mistake?


$image = imagecreatetruecolor(800, 600);
$red = imagecolorallocate($image, 250, 0, 0);

$result=mysqli_query($con,"SELECT * FROM points"); 
mysqli_set_charset($con, "utf8");

while($select=mysqli_fetch_array ($result)) 

$id = $select['id'];
$x = $select['x'];
$y = $select['y'];

for ( $i=0; $i < count($x); $i++ ) 
imagefilledellipse($image, $x[$i], $y[$i], 10, 10, $red);

header( 'Content-type: image/jpeg' );
imagepng( $image );



Maybe provide more information on this topic.

This might help you?

Answered By – sme3x

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published