Code Comments
Programming Forum and web based access to our favorite programming groups.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>";
?>
Post Follow-up to this messagehuwpioden@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.
Post Follow-up to this messageOn 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
Post Follow-up to this messagefletch 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
Post Follow-up to this messageOn 20 Sep 2006 04:32:12 -0700, "huwpioden@gmail.com" <huwpioden@gmail.com> w rote: >result = @m you forgot $ result = @m $result = @
Post Follow-up to this messageOn 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
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.