Daniish
asked on
What's wrong with my SQL syntax?
Hello,
I have written the following SQL query to find the local region:
$lreg = mysql_query("SELECT lat,lng,maxzl,icon FROM regions WHERE locations['reg_id']");
and i'm using the following to process the results:
// this displays the local Regional marker
while ($row=mysql_fetch_object($ lreg)){
echo '<reg_local lat="'.$row['lat'].'" lng="'.$row['lng'].'" maxzl="'.$row['maxzl'].'" icon="arrow"/>';
}
Can't for the life of me see what's wrong but Firebug reports the following regarding the line beginning 'While':
: mysql_fetch_object(): supplied argument is not a valid MySQL result resource
You can see this here (line 66):
http://www.globexposure.net/includes/read.php
Any tips appreciated
I have written the following SQL query to find the local region:
$lreg = mysql_query("SELECT lat,lng,maxzl,icon FROM regions WHERE locations['reg_id']");
and i'm using the following to process the results:
// this displays the local Regional marker
while ($row=mysql_fetch_object($
echo '<reg_local lat="'.$row['lat'].'" lng="'.$row['lng'].'" maxzl="'.$row['maxzl'].'" icon="arrow"/>';
}
Can't for the life of me see what's wrong but Firebug reports the following regarding the line beginning 'While':
: mysql_fetch_object(): supplied argument is not a valid MySQL result resource
You can see this here (line 66):
http://www.globexposure.net/includes/read.php
Any tips appreciated
your where clause is missing "fieldName=". Do you have a field named "reg_id"? If so, try:
$lreg = mysql_query("SELECT lat,lng,maxzl,icon FROM regions WHERE reg_id = {locations['reg_id']}");
$lreg = mysql_query("SELECT lat,lng,maxzl,icon FROM regions WHERE reg_id = {locations['reg_id']}");
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
use mysql_fetch_array instead and try
ASKER
Sorry for the delay in getting back to you...
I have changed the WHERE clause to:
$lreg = mysql_query("SELECT lat,lng,maxzl,icon FROM regions WHERE {locations['reg_id']} = id");
and i have tried using:
mysql_fetch_array
mysql_fetch_assoc
mysql_fetch_object
None of these have worked.
What do you suppose i try next?
I have changed the WHERE clause to:
$lreg = mysql_query("SELECT lat,lng,maxzl,icon FROM regions WHERE {locations['reg_id']} = id");
and i have tried using:
mysql_fetch_array
mysql_fetch_assoc
mysql_fetch_object
None of these have worked.
What do you suppose i try next?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
When this MySQL query is included in my read file it causes Firebug to report this problem:
handleErrors is not defined
http://www.globexposure.net/index_dubious.php
Line 291
I have created a development version of the site & read file, where you can see this:
www.globexposure.net/index_dubious.php
Obviously not sure why this is happening
handleErrors is not defined
http://www.globexposure.net/index_dubious.php
Line 291
I have created a development version of the site & read file, where you can see this:
www.globexposure.net/index_dubious.php
Obviously not sure why this is happening
I opened the page without any errors?!
ASKER
Not sure what occurred with regards to the error i was getting but your support was very helpful.
WHERE locations['reg_id'] = "Some number" ;