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