forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: phill104 on June 16, 2007, 11:11:54 pm

Title: php code problem
Post by: phill104 on June 16, 2007, 11:11:54 pm
I'm trying to do a custom google map thing where users can enter some details in a form, this is then uploaded to a Mysql database. This is for a little google map thing I'm doing to show more details about the coppermine photo they have upload which can then link from the map to the photo.

I had the code working well but suddenly it seemed to go wrong and now I have been staring at it for ages and my eyes are going wonky.

it returns the error

Parse error: parse error, unexpected ';' in /data/members/paid/w/i/windsurf.me.uk/htdocs/www/usermap.php on line 42

here is the code

Code: [Select]
<?php
$link 
mysql_connect("localhost""********""********") or die("Could not connect: " mysql_error());
mysql_selectdb("windsurf_me_uk_4",$link) or die ("Can\'t use dbmapserver : " mysql_error());

$result mysql_query("SELECT * FROM locations",$link);
if (!
$result)
{
echo 
"no results ";
}
while(
$row mysql_fetch_array($result))
{
echo 
"var point = new GLatLng(" $row['field_10'] . "," $row['field_9'] . ");\n";
echo 
"var marker = createMarker(point, '" addslashes($row['field_2'] . "<br />" $row['field_3'] . "<br />" $row['field_4'] . "<br />" $row['field_4'] . "<br />" $row['field_6'] . "<br />" $row['field_7'] . "<br />" $row['field_8'] . " <br /><a href=\"" $row['field_11'] . "\">" $row['field_11'] . "</a><br/>" $row['field_12'] . "<br />');\n";
echo 
"map.addOverlay(marker);\n";
echo 
"\n";
}

mysql_close($link);
?>

line 42 is the echo "var marker line.

Can any of you see what is going on here?

[Edited by Sami]:
Mysql Username/password Removed as requested
Title: Re: php code problem
Post by: phill104 on June 16, 2007, 11:13:41 pm
Could someone edit out the mysql password in my previous post too?
Title: Re: php code problem
Post by: Sami on June 16, 2007, 11:33:29 pm
there is a missing ) here :
Code: [Select]
addslashes($row['field_2']
:)
Title: Re: php code problem
Post by: phill104 on June 17, 2007, 12:00:35 am
Cheers Sami (on both counts)

I've just got to suss out cpmfetch now and rewrite the form (using the excellent phpformgen http://phpformgen.sourceforge.net (http://phpformgen.sourceforge.net), saves all that nasty coding of forms and it's free) and I should be good to go with the finish thing. I'll post it on this site when it's finished.
Title: Re: php code problem
Post by: Sami on June 17, 2007, 12:07:17 am
good luck phill :)