Home > Archive > PHP Language > September 2006 > Syntax error?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| huwpioden@gmail.com 2006-09-20, 7:57 am |
| 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>";
?>
| |
| fletch 2006-09-20, 7:57 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! 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.
| |
| Mumia W. (reading news) 2006-09-20, 7:57 am |
| 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
| |
| huwpioden@gmail.com 2006-09-21, 6:57 pm |
|
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
| |
|
| On 20 Sep 2006 04:32:12 -0700, "huwpioden@gmail.com" <huwpioden@gmail.com> wrote:
>result = @m
you forgot $
result = @m
$result = @
| |
|
| On 20 Sep 2006 04:32:12 -0700, "huwpioden@gmail.com" <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. :(
>
>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 lines there are many good
editors out there I hppen to really like crimson it's free, fast has some slick features
|
|
|
|
|