Jump to content

Simple array problem?


grahamb314

Recommended Posts

I'm trying to learn arrays and I have this problem:

 

I have a variable $a which is a result from a  from a database query

 

If I echo it I get:

forenamesurnamedate_of_birthgenderpaypal_addresspayment_planaddress_line_1address_line_2address_cityaddress_zip_post_codeaddress_countrytelephonemobilewhere_did_you_hearreceive_newsletter 

If I var_dump($a) I get:

string( "forename" string(7) "surname" string(13) "date_of_birth" string(6) "gender" string(14) "paypal_address" string(12) "payment_plan" string(14) "address_line_1" string(14) "address_line_2" string(12) "address_city" string(21) "address_zip_post_code" string(15) "address_country" string(9) "telephone" string(6) "mobile" string(18) "where_did_you_hear" string(18) "receive_newsletter" 

 

My question is, how do I get each value from a? It looks like an array to me because it holds multiple strings. I need to get the first, second and third elements printed on the page and used in other areas of my program.

 

Thanks in advance

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.