PHP "Hip hip array"

This is a discussion on "PHP "Hip hip array"" within the PHP Forum section. This forum, and the thread "PHP "Hip hip array" are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jul 8th, 2006, 22:21
Junior Member
Join Date: Oct 2004
Location: Helston, Cornwal
Age: 34
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
PHP "Hip hip array"

Hello

I am creating a google site map and need to create some urls - the url works fine until I add the array quoted below, I then get this error-

Parse error: syntax error, unexpected '.' in /home/visitdev/public_html/jamie.php on line 143

do { $town=str_replace(' ', '-',$row_rs_sitemapnamename['town']);$area=str_replace(' ', '-',$row_rs_sitemapnamename['area']);
$_xml .="<url><loc>http://www.choosespain.com/
Quote:
". $areaCornwall = array('Restormel', 'Carrick', 'North Cornwall', 'Kerrier', 'Penwith', 'Caradon' );
if(in_array($row_rs_sitemapnamename['area'], $areaCornwall))
{
echo "Cornwall";
}
else {
echo "Devon";
}
."
/". $area."/". $town."/accommodation</loc><lastmod>2006-04-10T07:51:05+00:00</lastmod><changefreq>daily</changefreq><priority>0.50</priority></url>\n";
} while ($row_rs_sitemapnamename = mysql_fetch_assoc($rs_townname));

Can anyone help me with this as I am pulling my hair out

Jamie H
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jul 8th, 2006, 22:30
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP "Hip hip array"

Well whats the . 's for?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jul 8th, 2006, 22:41
Junior Member
Join Date: Oct 2004
Location: Helston, Cornwal
Age: 34
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP "Hip hip array"

do { $town=str_replace(' ', '-',$row_rs_sitemapnamename['town']);$area=str_replace(' ', '-',$row_rs_sitemapnamename['area']);
$_xml .="<url><loc>http://www.choosespain.com/". $areaCornwall = array('Restormel', 'Carrick', 'North Cornwall', 'Kerrier', 'Penwith', 'Caradon' );
if(in_array($row_rs_sitemapnamename['area'], $areaCornwall))
{
echo "Cornwall";
}
else {
echo "Devon";
}
."/". $area."/". $town."/accommodation</loc><lastmod>2006-04-10T07:51:05+00:00</lastmod><changefreq>daily</changefreq><priority>0.50</priority></url>\n";
} while ($row_rs_sitemapnamename = mysql_fetch_assoc($rs_townname));

Is the code more clearly, when I normally use it I would put

<?php $areaCornwall = array('Restormel', 'Carrick', 'North Cornwall', 'Kerrier', 'Penwith', 'Caradon' );
if(in_array($row_rs_sitemapnamename['area'], $areaCornwall))
{
echo "Cornwall";
}
else {
echo "Devon";
}
?>

That did not work, so I tried

". script xyz ."

The reason being I do not know what else to do, I have know idea of how to form it correctly.

Jamie
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Jul 9th, 2006, 22:31
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP "Hip hip array"

What's this line supposed to be doing?
Code: Select all
      ."/". $area."/".
Not a lot I would suggest and probably the source of your error message.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Jul 9th, 2006, 22:34
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP "Hip hip array"

Yep for sure...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
php, quothip, hip, arrayquot

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a "tag" system to find relevant "related" pages MrQuestions PHP Forum 3 Mar 20th, 2008 23:06
[SOLVED] Show "Image" Depends On User "Status"? Monie Classic ASP 6 Oct 16th, 2007 01:22
? IS "meta name="robots" content="?" necessary in pages ? Love2Java Starting Out 6 Aug 8th, 2007 13:48
window.opener.document["nameForm"].getElementById("someid").value; doesnt work drpompeii JavaScript Forum 0 Feb 17th, 2007 23:09
Need to build a "Trip" or "Journey Planner" jswebdev PHP Forum 4 Dec 5th, 2005 23:22


All times are GMT. The time now is 08:59.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42