I need help with a php / mysql thing
For Seesmic World Project, I want to plot the video replies on a Google Map. The points will be geocoded by address off of the blog posts for example:
- Paris, France
- Cary, NC
- Riverside County, California
- Paris, France
As you can see from the list above, some posts will have the same title. Meaning when they are passed into Google Maps they will have the same Lat/Lon. When this happens, only the last point passed in will show. Basically what I need to do is take the query result and loop through it, combining the $post_content of duplicate $post_title’s into one $post_title
Did that make sense?
So, if I have
Post: Paris, France
Content: Hello, I am Steve from ParisPost: Cary, NC
Content: Hello, I am Critter from CaryPost: Paris, France
Content: Good Evening, I live in Paris
Would become:
Post: Paris, France
Content: Hello, I am Steve from Paris
Good Evening, I live in ParisPost: Cary, NC
Content: Hello, I am Critter from Cary
Any suggestions or assistance would be greatly appreciated. PHP is not really my thing.
Posted under Site News
select DISTINCT town, action FROM world project where town=’Paris’ should do it no ?
Hi Crit,
Yes, perhaps the easiest way is to output the query into an array holding the post title and content. Then you can find each unique $post_title and then loop through the original array and concatenate each $post_content when the $post_title is found.
$post_titles = array_unique($yourarrayofpost_titles);
This will give you the unique titles.
Then for each $post_titles, loop through the returned records and build out the string. Hope that helps! It’s hard for me to see/write/test without working with the core.
Doug
Add A Comment