Forum Moderators: open
I'm using this script to show my articles in a database mysql.
<%
SQLConn = "Driver={mySQL}; Server=*******; Database=********; Uid=***********; Pwd=********;"
on error resume next
dim objConn,objRecordset
set objConn=server.createObject("adodb.connection")
objConn.open SQLConn
if err.number>0 then
response.write ("errore all'apertura della connessione")
response.end()
end if
dim sql
sql = "SELECT * FROM news ORDER BY data LIMIT 0,30"
set objRecordset=Server.CreateObject("adodb.recordset")
objRecordset.open sql,objConn,1,3
if not objRecordset.eof then
while not objRecordset.eof
response.write "<a href=""articolo.asp?id=" & objRecorset("id") & """ class=""Stile20"">" & objRecordset("titolo") & "</a><br>" & objRecordset("toptesto") & "<br>Pubblicato il: " & objRecordset("data") & "<br><br>"
objRecordset.movenext
wend
else
response.write "no record found"
end if
objRecordset.close: set objRecordset=nothing
objConn.close: set objConn=nothing
%>
In database Mysql there are 1.000 record, but the result is
"no record found"
How can i correct this script?
Thanks
try removing the LIMIT clause and see what happens.
everything else looks good to me. it's a very basic query.
have you run that query in a DB client such as mySQL Front?
also you have a typo here:
objRecorset("id") &but that would throw an error rather than an EOF.
Can you help me to rewrite the code using this?
Thanks