Append number to array

I would like to add a number to this array:

<div class="stars" data-id="<?php echo $attorneysStuff['bizID'];?>2" data-stars="10" data-title="Pricing">

<?php schema($attorneysStuff['bizID'],10);?>

</div>


So it should be like this. In this case "2" is added, but it will not work this way:

[code]

<?php schema($attorneysStuff['bizID2'],10);?>

Open in new window

seoptiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GaryCommented:
Whats the error - there is nothing wrong with the code
0
seoptiAuthor Commented:
The problem with the code is, there is no bizID2, there is only a bizID.

So this will code will not append the number "2" to the bizID.

<?php echo $attorneysStuff['bizID2'];?> 

Open in new window

0
GaryCommented:
Not following you - if it doesn't exist then why are you trying to access it or do you mean

<?php echo $attorneysStuff['bizID']."2";?>
0
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

seoptiAuthor Commented:
Thank you but still looking for the solution of this:

<?php schema($attorneysStuff['bizID'],2,10);?>

bizID needs the element 2 added at the and, after this ,10
0
GaryCommented:
What is schema
0
seoptiAuthor Commented:
schema is a function.

<?php schema('someItemID');      //print schema.org rich snippets
schema('someItemID',10);      //print schema.org rich snippets with 10 - as maximum possible rating

Usually I append a sub-id to the bizID like this:
<?php echo $attorneysStuff['bizID'];?>2

But in the case above I have to get the syntax for:
<?php schema($attorneysStuff['bizID'],2,10);?>

I'm trying this for hours but without any result.
0
GaryCommented:
And whats the code?
You can't ask use to help you do something and not show the code
0
seoptiAuthor Commented:
This is the code for the schema function:

 USAGE EXAMPLE (your_file.php):
   
   <?php
   
      include_once ('www.your_site.com/path_to/snippets.php');		//include snippets.php file
      
      $itemID='myItem';		//item ID for which rich snippets will be displayed
      
      //call one of the functions, depending on which rich snippets you already use in your project
      schema($itemID);		//(recommended)
      //microdata($itemID);
      //microformat($itemID);
      //PDFa($itemID);
      
   ?>
   
   
*/





//template for schema.org
function schema($item_id, $best=5, $round=null){
    $stats = getStats($item_id, $best, $round);			//get rating from DB
    
	//in case of any database related errors
	if($stats==0) {echo ' !Error! '; return;}
	
	//dont print snippet if item has less then 1 vote to avoid google error message
//	if($stats['votes']<1) {echo '<br />item has less then 1 vote'; return;}
	
	//markup template for scheme.org. Edit it as you like.  
	$template = <<< EOF
	
	
<div itemscope itemtype="http://schema.org/CreativeWork">
	<a itemprop="url" href="{$stats['url']}">
		<span itemprop="name">{$stats['title']}</span>
	</a> 
	<span itemprop="aggregateRating"	itemscope itemtype="http://schema.org/AggregateRating">
		<meta itemprop="worstRating" content = "0">
		<span itemprop="ratingValue">{$stats['average']}</span> 
		out of <span itemprop="bestRating">{$stats['best']}</span> 
		(based on <span itemprop="ratingCount">{$stats['votes']}</span> ratings)
	</span>

</div>

Open in new window

0
GaryCommented:
bizID needs the element 2 added at the and, after this ,10
Doesn't make sense
0
tel2Commented:
> Doesn't make sense
I'm struggling with this use of the English language too, Gary.
A bit (or even a byte) more time spent in giving enough info and writing things clearly could save everyone a lot of time in the long run, IMHO.  It's fortunate the some experts are very patient, which is impressive considering what they get "paid".
0
Ray PaseurCommented:
Let's try this.

1. Please show us the data you have for input - not the code, just the data.  If you want you can use var_dump() to print out the values of the data.

2. Please show us the output you want to get from the data.

With that information we can usually show you the exact code to achieve the result.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tel2Commented:
You must be better than you even know, Ray.
0
seoptiAuthor Commented:
Of course Rays question was the answer. His question helped me solving this problem.

The other posters complained they are underpaid and it maked no sense, Ray provided a question which led to a solution so where is the problem?
0
seoptiAuthor Commented:
Maybe you should pay the experts more so they will not be that frustrated about solving questions, just a suggestion.
0
GaryCommented:
posters complained they are underpaid
No one complained about being underpaid, tel2's comment was sarcasm because we are not paid.
All experts on here do it of their own free will

Now care to explain how a question asking for the data is an answer.
0
Ray PaseurCommented:
Maybe you should pay the experts more...
Ha!  Yes please raise my salary from E-E by at least 10%.  So many questions are answered by just getting from the initial question to the SSCCE!
0
seoptiAuthor Commented:
They don't pay you but I pay them. So you for sure have high morals if you help poor coding souls if you are not paid :)

No rellay, they really don't pay the experts, what a shame!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.