Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PHP Echo array question

Posted on 2014-11-07
5
Medium Priority
?
123 Views
Last Modified: 2014-11-16
Having a hard time to echo $agentsStuff within this line of code:

schema (echo $agentsStuff[bizID]1,10);

Open in new window

0
Comment
Question by:seopti
  • 3
  • 2
5 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 40429212
Please run this PHP instruction and post the output here, thanks.

<?php var_dump($agentsStuff);

Open in new window

0
 

Author Comment

by:seopti
ID: 40429264
I have a bizID for each business in the database which I can echo with:

<?php echo $agentsStuff['bizID'];?>

Now I've installed an addon which adds schema org. It is printed this way:

<?php schema('someItemID');      //print schema.org rich snippets  ?>

What I would like to do is to echo the bizID as someItemID. I tried this for a few hours without success.
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 40429527
I tried this for a few hours without success.
Don't waste your time like that.  Just work with me.

Please run this PHP instruction and post the output here, thanks.

<?php var_dump($agentsStuff);

Open in new window

0
 

Author Comment

by:seopti
ID: 40430390
When I do var_dump  on $agentsStuff I get:

array(30) { [0]=> string(6) "624082" ["bizID"]=> string(6) "624082" [1]=> string(9) "Attorneys" ["bizCatSub"]=> string(9) "Attorneys" [2]=>  .....

And there is the bizID which I need echoed as someItemID.
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 40430449
It looks like you've got a results set from a query, and you've used MySQL_Fetch_Array() to retrieve the data.  That's an AntiPractice (see number 27 for an explanation of why you want to change that).

To get a different column name in the results set, and therefore a different key in the array, you can change your query to use the AS clause in the SELECT query.  Example:

SELECT bizID AS someItemID FROM myTable...

I don't understand part of this question about this line of code:
schema (echo $agentsStuff[bizID]1,10);

Open in new window

What is schema()?  Is it some kind of locally defined function?  What does "1,10" mean in this context?
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question