Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 06-09-2011, 03:14 PM Help with Arrays!
coldturkey's Avatar
Extreme Talker

Posts: 211
Name: Rachel
Location: Spain
Trades: 3
Hi,
Just wondering if someone could help me, as I'm a little out of my depth and it's just not working!

I have a database which is good - the information is in Spanish and on one page of the web site I want the information to be in English.
So I have created an array:

PHP Code:
<?php require_once('../db_connect.php');
    
$where_clause ""$prefix " and ";
// Create array.
$good_event = array (
'Rutas 4X4' => '4X4 Trails',
'Senderismo' => 'Hiking',
'Espeleo' => 'Caving',
'Descenso de Barranco' => 'Canyoning',
'Rutas a Caballo' => 'Horse Riding',
'Paseos en Bicicleta' => 'Bike Rides',
'Kayak' => 'Kayak',
'Visitas' => 'Guided Visits',
);
if (
strlen($_GET['event']) > && isset($good_event[$_GET['event']])) {
  
$where_clause .= $prefix."event='".$good_event[$_GET['event']]."'";
  
$prefix " and ";
}
$query "SELECT * FROM calendar_event GROUP BY month, day, year ORDER BY month ASC limit 10"
$result mysql_query($query);
while(
$row mysql_fetch_array($result))
{
 echo 
"<a href='http://www.domain.com/calendario-actividades.php'>".$good_event[$row->event]."</a><br>
 <a href='http://www.domain.com/calendario-actividades.php'>
{$row['day']}/{$row['month']}/{$row['year']} <br> {$row['location']}
<br>
{$row['description']}
</a>
 <img src='../images/img15-short.jpg' alt='Salamanda Multi Aventura' />
 "
;
 } 
?>
But it just not showing the translation in the array - I have changed it so many times and looked it up in php.net but I haven't found the solution.
Would really appreciate a bit of help.

Thanks
Rachel
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

coldturkey is offline
Reply With Quote
View Public Profile Visit coldturkey's homepage!
 
 
Register now for full access!
Old 06-09-2011, 03:28 PM Re: Help with Arrays!
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
The only thing I see wrong is here:
PHP Code:
echo "<a href='http://www.domain.com/calendario-actividades.php'>".$good_event[$row->event]."</a><br> 
$row is an array, not an object. Try $row['event'] instead.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 06-09-2011, 03:37 PM Re: Help with Arrays!
coldturkey's Avatar
Extreme Talker

Posts: 211
Name: Rachel
Location: Spain
Trades: 3
Quote:
Originally Posted by NullPointer View Post
The only thing I see wrong is here:
PHP Code:
echo "<a href='http://www.domain.com/calendario-actividades.php'>".$good_event[$row->event]."</a><br> 
$row is an array, not an object. Try $row['event'] instead.
Thank you for your help above.... now come up with the error...
Parse error: syntax error, unexpected ';', expecting ']' in

__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

coldturkey is offline
Reply With Quote
View Public Profile Visit coldturkey's homepage!
 
Old 06-09-2011, 03:44 PM Re: Help with Arrays!
coldturkey's Avatar
Extreme Talker

Posts: 211
Name: Rachel
Location: Spain
Trades: 3
Quote:
Originally Posted by coldturkey View Post
Thank you for your help above.... now come up with the error...
Parse error: syntax error, unexpected ';', expecting ']' in

FIXED - Thanks for your help
You got me thinking in a new light and I had to check a few times to se if it was really working.... but YAY! Its working!!

I did this in the end! Doh!

PHP Code:
".$good_event {$row['event']}." 
Thanks a million!
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

coldturkey is offline
Reply With Quote
View Public Profile Visit coldturkey's homepage!
 
Reply     « Reply to Help with Arrays!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13811 seconds with 12 queries