Associate
- Joined
- 11 Oct 2008
- Posts
- 268
I have a little bit of code that is generating two random co-ordinates (posX and posY) as numbers.
When it generates the two numbers, I would like it to check if both them positions are in the database.
If they are, it means theres already something there, so do nothing.
If they do not exist in the database, run some more code to put something there etc.
Is it possible to to check for two values at the same time using PDO.
Just incase it helps at all, here is the code I have so far:
Thanks for any help
When it generates the two numbers, I would like it to check if both them positions are in the database.
If they are, it means theres already something there, so do nothing.
If they do not exist in the database, run some more code to put something there etc.
Is it possible to to check for two values at the same time using PDO.
Just incase it helps at all, here is the code I have so far:
PHP:
if ($randNum == 1) {
$validPos = [
[200, 200],
[250, 250],
[425, 425],
];
$placeEnemy = $validPos[mt_rand(0, count($validPos) - 1)];
echo $placeEnemy[0].'<br>'.$placeEnemy[1].'<br>';
if $placeEnemy[0] and $placeEnemy[1] exist in databse {
run code to insert enemy (I can do this part :))
} else if they exist in database {
echo "Cannot start";
}
}
Thanks for any help
