Jump to content

New String Problem


seran128

Recommended Posts

The code from phoogle says

[code]$map->addAddress('210 Doster Ave, Mooresville, NC 28115',"<em>This is another address</em> that is italic");[/code]

I want to add a description from my database to the end of my string that I am sending to google

My Code

[code]$description = "<br>Date:".$row["date"]."<br>Description:".$row["description"];
echo $description;
$map->addAddress("$row[address1],$row[city],$row[state] $row[zip],$description");[/code]

The page returns

Date:12/8/06
Description:Fri-Sat 8am-4pm Sun 1pm-4pm call for Directions 850-xxx-xxxx
Warning: file_get_contents(http://api.local.yahoo.com/MapsService/V1/geocode?appid=YahooDemo&location=2712+Shoni+Dr%2CNavarre%2CFL+32566%2C%3Cbr%3EDate%3A12%2F8%2F06%3Cbr%3EDescription%3AFri-Sat+8am-4pm+Sun+1pm-4pm+call+for+Directions+850-396-5898) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /home/mysite/public_html/phoogle.php on line 129

Link to comment
https://forums.phpfreaks.com/topic/29535-new-string-problem/
Share on other sites

The problem is in your call here:
[code]$map->addAddress("$row[address1],$row[city],$row[state] $row[zip],$description");[/code]

It takes TWO values, but you have everything enclosed in double quotes so it is interpreted as a single value. You can verify that by looking at the location value in the query string of the error message. Try this:

[code]$map->addAddress("$row[address1],$row[city],$row[state] $row[zip]",$description);[/code]
Link to comment
https://forums.phpfreaks.com/topic/29535-new-string-problem/#findComment-135525
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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