Hello,
I work in PHP and dont know much about javascript. I am trying to create a XML Parser using PHP.I want the output in a javascript string.
This is the part where i am saving the code in javascript string.
if(count($new_array)<=0)
{
[COLOR=”Blue”]$add=”code=”<table width=’500′ cellpadding=’4′ align=’center’ bgcolor=’#CCCCCC’>”;”;
$add.=”code+=”<tr><td align=’center’ class=’text’>”;”;
$add.=”code+=”<b>No Match Found….</b>”;”;
$add.=”code+=”</td></tr></table>”;”;
}
else
{
////////some php code///////////////
if(is_array($bid_id_array))
{
[COLOR=”Blue”]$add=”code=”<table width=’500′ cellpadding=’2′ align=’center’><tr><td>”;”;
foreach ($bid_id_array as $key => $val )
{
$limit_count++;
if($limit_count>$final_total_rec) break;
$title=$new_array[‘title’][$key] ;
$link=$new_array[‘link’][$key] ;
$desc=$new_array[‘desc’][$key];
$bid=$new_array[‘bid’][$key];
[COLOR=”Blue”]$add.=”code+=”<p id=’results’><a href='”.$link.”‘ target='”.$target.”‘><b>”.$title.”</b></a><br>”.$desc.”<br></p>”;”;
}//for each loop
[COLOR=”Blue”]$add.=”code+=”</td></tr></table>”;”;
}//if
else
{
[COLOR=”Blue”]$add.=”code+=”<table width=’500′ border=’0′ cellpadding=’2′ align=’center’ bgcolor=’#CCCCCC’><tr><td class=’text’ align=’center’><b>No Match Found….</b></td></tr></table>”;”;
}
[COLOR=”Blue”]$add.=”document.write(code);”;
print(html_entity_decode($add));
} //else
I am getting the output properly but in between [COLOR=”Red”]“code=”[COLOR=”Red”]“;code+=”[COLOR=”Red”]“;document.write(code);
I know this problem has to do something with unterminated string.So please the above code and let me know where excatly is the problem with javascript string concatenation.
thanks in advance,
coolbuddy