Jump to content

Help with checking offset


EchoFool

Recommended Posts

If there is an automated script which creates an array but there is no parametres that match to create this "array" is there a way to check that the array is in simple words... blank?

 

Because at the moment after my while loop which creates the array i have:

$_SESSION['MissionID'] = $a[0];

 

But if the array wasn't greated because all the rows have been used which can happen then obviously $a[0]; won't exist.

 

So i end up with:

Notice: Undefined offset: 0 in C:\xampp\htdocs\test.php on line 6431

 

So was wondering if there was a way to "check" if the array is blank and if it is then skip it.

 

I tried this:

<?php
If($a[0]>0){
// do it
}Else { // do not 
}

 

Didn't work though. Any suggestions?

But that didn't work.

 

 

Link to comment
https://forums.phpfreaks.com/topic/115103-help-with-checking-offset/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.