Undefined index is a array notice. So possible notice source is 'placeno'.$i
. You need to check it on every loop.
I am assuming you are looping this code with for()
loop. That is where $i
is coming from.
<?php
if (isset($_SESSION['placeno'.$i])) {
$query = mysql_query("SELECT `id` FROM `place` WHERE `placeno` = '".$_SESSION['placeno'.$i]."' LIMIT 1");
while($row = mysql_fetch_object($query)){
}
}
?>
If it's a loop, you can stop the loop like this:
<?php
if (!isset($_SESSION['placeno'.$i])) {
break;
}
$query = mysql_query("SELECT `id` FROM `place` WHERE `placeno` = '".$_SESSION['placeno'.$i]."' LIMIT 1");
while($row = mysql_fetch_object($query)){
?>