I'm trying to make a grid/map based on coordinates, and instead of inputting a million rows manually I'm trying to figure out a way to do it in just a few queries but I'm having trouble wrapping my mind around how to do it.
What I want it to do is enter a row for each coordinate to create a 1000x1000 square with each square in the grid being a row I just need some help figuring out how to actually put this in a query.
I ran this code twice one time each with the while loop +1 each time for $onecoord and then once with it adding +1 to $twocoord I knew it wouldn't fully fill out the table it only added 999 coordinates each time.
$onecoord = 1;
$twocoord = 1;
while($twocoord < 1000) {
mysqli_query($link,"INSERT INTO coords (x, y, walkable, image, spawn)
VALUES('".$onecoord."','".$twocoord."','1','grass2.png','0')")
or die($link->error);
$twocoord = $twocoord + 1;
}
Any help would be very much appreciated, thanks in advance.
.
.
.
.
.
.
.
.
. . . . . . . . . . .
That is what the coords I'm getting look like I want to make it so it is a full square + completely filled in with each dot ='s a row in the database.