Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Syntax error?
Hi everyone,

My first post to this group so please be gentle ;)

I've been staring at the code below for almost two hours and I can't
figure out what's wrong! The code below is a mash-up of code I'd
previously wrote and tested (I used to use nearby.org.uk for geocoding)
and iSharemaps example PHP code. I can't see any syntax errors in the
code - but still it refuses to excecute. :(

Stranger still it doesn't even print the 'Starting ...' entry at the
top of the page - which suggests that something quite substantial is
wrong! Hopefully someone can throw some light on what's going wrong
here.

Thanks for your attention.

Huw
==== Code ====
<?php

echo "<p>Starting ...... </p>";

require('../config.php');

include('lib/wscaller.php');

// iSharemaps license key
$licensekey = 'wsxxxx-xxxx-xxxx';

$sql="SELECT post_code FROM organisation WHERE pc_updated = '0'";
result = @mysql_query($sql,$connection) or die("Couldn't execute
query.". $php_errormsg . mysql_error());

while ($row = mysql_fetch_array($result)) {
$input = $row['post_code'];

if (isset($input)) {

$postcode = array(
'postcode' => $input
);
$result = searchFormattedAddress($licensekey, $postcode);

$longitude = $result[0]['x'];
$latitude = $result[0]['y'];

$sql_1="UPDATE organisation SET lat='$latitude',lon='$longitude',
pc_updated='1' WHERE post_code='$input'";
$result = mysql_query($sql_1, $connection) or die ("Error. Couldn't
input co-ordinates." . $php_errormsg . mysql_error());

}
}


echo "<p>Finished!</p>";

?>


Report this thread to moderator Post Follow-up to this message
Old Post
huwpioden@gmail.com
09-20-06 12:57 PM


Re: Syntax error?
huwpioden@gmail.com wrote:
> Hi everyone,
>
> My first post to this group so please be gentle ;)
>
> I've been staring at the code below for almost two hours and I can't
> figure out what's wrong! The code below is a mash-up of code I'd
> previously wrote and tested (I used to use nearby.org.uk for geocoding)
> and iSharemaps example PHP code. I can't see any syntax errors in the
> code - but still it refuses to excecute. :(

You seem to be reusing $result in the while. That probably means it
will loop forever, and if the output buffer is turned on in the php.ini
then you would not get any output.


Report this thread to moderator Post Follow-up to this message
Old Post
fletch
09-20-06 12:57 PM


Re: Syntax error?
On 09/20/2006 06:32 AM, huwpioden@gmail.com wrote:
> Hi everyone,
>
> My first post to this group so please be gentle ;)
>
> I've been staring at the code below for almost two hours and I can't
> figure out what's wrong! [...]

Perhaps it would enlighten you if you put "error_reporting(E_ALL);" at
the top of your script. That'll report script errors better.


--
paduille.4058.mumia.w@earthlink.net

Report this thread to moderator Post Follow-up to this message
Old Post
Mumia W. (reading news)
09-20-06 12:57 PM


Re: Syntax error?
fletch wrote:
> You seem to be reusing $result in the while.

Naaaaah. I was using result .... $result would have let it work!!!
Dooooh.

Thanks for the interest anyway.

Huw


Report this thread to moderator Post Follow-up to this message
Old Post
huwpioden@gmail.com
09-21-06 11:57 PM


Re: Syntax error?
On 20 Sep 2006 04:32:12 -0700, "huwpioden@gmail.com" <huwpioden@gmail.com> w
rote:

>result = @m



you forgot $
result = @m
$result = @

Report this thread to moderator Post Follow-up to this message
Old Post
Gleep
09-22-06 08:57 AM


Re: Syntax error?
On 20 Sep 2006 04:32:12 -0700, "huwpioden@gmail.com" <huwpioden@gmail.com> w
rote:

>Hi everyone,
>
>My first post to this group so please be gentle ;)
>
>I've been staring at the code below for almost two hours and I can't
>figure out what's wrong! The code below is a mash-up of code I'd
>previously wrote and tested (I used to use nearby.org.uk for geocoding)
>and iSharemaps example PHP code. I can't see any syntax errors in the
>code - but still it refuses to excecute. :(
>
>Stranger still it doesn't even print the 'Starting ...' entry at the
>top of the page - which suggests that something quite substantial is
>wrong! Hopefully someone can throw some light on what's going wrong
>here.
>
>Thanks for your attention.
>
>Huw
>==== Code ====
><?php
>
>echo "<p>Starting ...... </p>";
>
>require('../config.php');
>
>include('lib/wscaller.php');
>
>// iSharemaps license key
>$licensekey = 'wsxxxx-xxxx-xxxx';
>
>$sql="SELECT post_code FROM organisation WHERE pc_updated = '0'";
>result = @mysql_query($sql,$connection) or die("Couldn't execute
>query.". $php_errormsg . mysql_error());
>
>while ($row = mysql_fetch_array($result)) {
>$input = $row['post_code'];
>
>if (isset($input)) {
>
>$postcode = array(
>'postcode' => $input
> );
>$result = searchFormattedAddress($licensekey, $postcode);
>
>$longitude = $result[0]['x'];
>$latitude = $result[0]['y'];
>
>$sql_1="UPDATE organisation SET lat='$latitude',lon='$longitude',
>pc_updated='1' WHERE post_code='$input'";
>$result = mysql_query($sql_1, $connection) or die ("Error. Couldn't
>input co-ordinates." . $php_errormsg . mysql_error());
>
>}
>}
>
>
>echo "<p>Finished!</p>";
>
>?>



errors like this are easy to spot when you use an editor that colorizes line
s  there are many good
editors out there  I hppen to really like    crimson    it's free, fast has 
some slick features

Report this thread to moderator Post Follow-up to this message
Old Post
Gleep
09-22-06 08:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Language archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 09:16 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.