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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.