Jump to content

[SOLVED] Empty array results ...


Avihai

Recommended Posts

Hello,

 

1) I have a script that pulls out information from a db table.

2) In the table I have 10 fields and the script pulls all the data from a certain field.

3) Some fields contain information and some don't.

4) All the gathered information is inserted into array.

 

My problem is when I output the result. To the fields that are empty I get "Undefined offset:"

and the fields that do contain information I can see the result via echo.

 

The question: How to I say in php to echo nothing when the fields is empty instead of printing the error?

 

Thanks,

Avihai

Link to comment
https://forums.phpfreaks.com/topic/86211-solved-empty-array-results/
Share on other sites

Thanks for the fast answer :-)

 

darkfreaks ... I had to change what you've posted to:

 

			if(isset($drex[1])){
					echo $drex[1];
			} 
			elseif(!isset($drex[1])){
					echo "nothing";
			}

 

I was playing around with isset before but I got it wrong ... thanks for clearing the issue.

 

Blessings,

Avihai

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.