|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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")) %> <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 |
|
#2
|
||||
|
||||
|
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"
This way you can see if the variables themselves are empty. Try executing the query against MySQL directly. |
|
#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. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > mysql syntax error HEELP! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|