MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 23rd, 2005, 12:04 PM
mekotelly mekotelly is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 3 mekotelly User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 51 m 38 sec
Reputation Power: 0
mysql syntax error HEELP!

hi guys got this error that making me go crazy anybody HEEELP ME!

i cant access the querry results of the scripts below

hello im ed from kenya.just starting to use mysql. got this syntax error could you please help me. below is the error and the code


--------------------------------------------------------------------------------

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[MySQL][ODBC 3.51 Driver][mysqld-4.1.1a-alpha]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'productid<>178 order by name' at line 1

/shop1/admin/product.asp, line 42


--------------------------------------------------------------------------------

this is the vbscript

set rscatlist=db.execute("select name, productid from products where catcode=" & rsprod("catcode") & "and productid<>" & valid_sql(productid) & " order by name")


--------------------------------------------------------------------------------

thisistheothererror

ADODB.Field error '80020009'

Either BOF or EOF is True, or the current record has been deleted; the operation requested by the application requires a current record.

?


<%
'Display a featured product

Set rsprod = Server.CreateObject("ADODB.Recordset")
rsprod.Open "select * from products where featured=true" , StrConn, adOpenStatic, adLockReadOnly
rmax=rsprod.recordcount

if not rsprod.eof then
t=Timer
Randomize t
rnum = Int(RND * rmax)
rsprod.move rnum


'set rsprod=db.execute("select * from products")

if not rsprod.eof then
%>
<%= rsprod("name") %>

<%= rsprod("featimage") %>
<% if rsprod("saleprice")="" or rsprod("saleprice")=0 then %>
<b>Price: <%= cursymbol & formatnumber(rsprod("price")) %>
<% else %>
<strike>Price: <%= cursymbol & formatnumber(rsprod("price")) %>
Sale: <%= cursymbol & formatnumber(rsprod("saleprice")) %>&nbsp;<img src="images/gifs/saletag.gif">
<% end if %>



<%= rsprod("shortdesc") %>
<% end if %>

<a href="addprod.asp?productid=<%= rsprod("productid")%>"><img src="images/gifs/add2cart.gif" border="0"></a>
<%
end if
db.Close
Set db = Nothing
%>


--------------------------------------------------------------------------------

your help will be appreciated my email is fyonza@yahoo.com

Reply With Quote
  #2  
Old August 23rd, 2005, 02:35 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
Not sure if it will make a difference, but you may need to add a space to the SQL command, as highlighted below.
Code:
"select name, productid from products where catcode=" & rsprod("catcode") & " and productid<>" & valid_sql(productid) & " order by name"
I suggest finding a way to output the query before it is printed.
This way you can see if the variables themselves are empty.
Try executing the query against MySQL directly.

Reply With Quote
  #3  
Old August 23rd, 2005, 03:00 PM
MichaelSoft MichaelSoft is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Location: The Netherlands
Posts: 121 MichaelSoft User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 20 sec
Reputation Power: 3
I'll go by MadCowDzz.

Indeed a good hint. I always print my query when I don't understand the error message, works like a charm.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > mysql syntax error HEELP!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway