Hi...
I am trying to convert a simple FAQ script to access mysql db rather than
the Access db it was designed for. The originators of the script offer no
support at all.
I have managed to set up the mysql db and have frigged the script to get it
running, however certain bits are not functional, i.e. the links on the
categories.
This is where I am so far
<%@LANGUAGE="VB SCRIPT" CODEPAGE="1252" %>
<%
Dim Conn
Dim RSBODY
Dim CatName
Dim RS
Dim SQLBODY
Dim SQLCat
Server.ScriptTi meout = 10000000
Set Conn = Server.CreateOb ject("ADODB.Con nection")
Conn.Open "Driver={MySQL} ; DATABASE=faqdb; UID=faq; PASSWORD=jakeca t;"
Set RSBODY = Server.CreateOb ject("ADODB.Rec ordset")
SQLBODY = "SELECT * from Settings"
RSBODY.Open SQLBODY, Conn, 1, 3
If request("Action ") = "Cat" Then
Set RSCat = Server.CreateOb ject("ADODB.Rec ordset")
SQLCat = "SELECT * from Categories WHERE ID=" & request("ID")
RSCat.Open SQLCat, Conn, 1, 3
CatName = RSCat("Category ")
RSCat.close
Set RSCat = Nothing
Set RS = Server.CreateOb ject("ADODB.Rec ordset")
RSSQL = "SELECT * from Questions WHERE Category=" & request("ID") & " AND
NOT Pending ORDER BY Question"
RS.Open RSSQL, Conn, 1, 3
ElseIf request("Action ") = "Q" Then
Set RS = Server.CreateOb ject("ADODB.Rec ordset")
RS.Open "Questions" , Conn, 2, 2
RS.Find "ID=" & request("ID")
RS("Views") = RS("Views") + 1
RS.update
RS.close
Set RS = Nothing
Set RS = Server.CreateOb ject("ADODB.Rec ordset")
RSSQL = "SELECT * from Questions WHERE ID=" & request("ID") & " AND NOT
Pending"
RS.Open RSSQL, Conn, 1, 3
ElseIf request("Action ") = "Search" Then
Set RS = Server.CreateOb ject("ADODB.Rec ordset")
RSSQL = "SELECT * from Questions WHERE Question LIKE '%" &
request("Keywor d") & "%' OR Answer LIKE '%" & request("Keywor d") & "%' AND
NOT Pending"
RS.Open RSSQL, Conn, 1, 3
ElseIf request("Action ") = "New" Then
Set RS = Server.CreateOb ject("ADODB.Rec ordset")
RSSQL = "SELECT * from Questions WHERE NOT Pending ORDER BY DateCreated
Desc"
RS.Open RSSQL, Conn, 1, 3
ElseIf request("Action ") = "Ask2" Then
Set RS = Server.CreateOb ject("ADODB.Rec ordset")
RS.Open "Questions" , Conn, 2, 2
RS.addnew
RS("Question") = Request("Questi on")
RS("Category") = Request("Catego ry")
RS("DateCreated ") = Date
RS("Pending") = True
RS.update
End If
%>
Working script using access http://www.alfa-it.co.uk/faq/default.asp
(windows host)
Almost working script using mysql
http://www.automateyourgates.co.uk/faq/default.asp (apache host)
Any help much appreciated
Thanks
Chris.
I am trying to convert a simple FAQ script to access mysql db rather than
the Access db it was designed for. The originators of the script offer no
support at all.
I have managed to set up the mysql db and have frigged the script to get it
running, however certain bits are not functional, i.e. the links on the
categories.
This is where I am so far
<%@LANGUAGE="VB SCRIPT" CODEPAGE="1252" %>
<%
Dim Conn
Dim RSBODY
Dim CatName
Dim RS
Dim SQLBODY
Dim SQLCat
Server.ScriptTi meout = 10000000
Set Conn = Server.CreateOb ject("ADODB.Con nection")
Conn.Open "Driver={MySQL} ; DATABASE=faqdb; UID=faq; PASSWORD=jakeca t;"
Set RSBODY = Server.CreateOb ject("ADODB.Rec ordset")
SQLBODY = "SELECT * from Settings"
RSBODY.Open SQLBODY, Conn, 1, 3
If request("Action ") = "Cat" Then
Set RSCat = Server.CreateOb ject("ADODB.Rec ordset")
SQLCat = "SELECT * from Categories WHERE ID=" & request("ID")
RSCat.Open SQLCat, Conn, 1, 3
CatName = RSCat("Category ")
RSCat.close
Set RSCat = Nothing
Set RS = Server.CreateOb ject("ADODB.Rec ordset")
RSSQL = "SELECT * from Questions WHERE Category=" & request("ID") & " AND
NOT Pending ORDER BY Question"
RS.Open RSSQL, Conn, 1, 3
ElseIf request("Action ") = "Q" Then
Set RS = Server.CreateOb ject("ADODB.Rec ordset")
RS.Open "Questions" , Conn, 2, 2
RS.Find "ID=" & request("ID")
RS("Views") = RS("Views") + 1
RS.update
RS.close
Set RS = Nothing
Set RS = Server.CreateOb ject("ADODB.Rec ordset")
RSSQL = "SELECT * from Questions WHERE ID=" & request("ID") & " AND NOT
Pending"
RS.Open RSSQL, Conn, 1, 3
ElseIf request("Action ") = "Search" Then
Set RS = Server.CreateOb ject("ADODB.Rec ordset")
RSSQL = "SELECT * from Questions WHERE Question LIKE '%" &
request("Keywor d") & "%' OR Answer LIKE '%" & request("Keywor d") & "%' AND
NOT Pending"
RS.Open RSSQL, Conn, 1, 3
ElseIf request("Action ") = "New" Then
Set RS = Server.CreateOb ject("ADODB.Rec ordset")
RSSQL = "SELECT * from Questions WHERE NOT Pending ORDER BY DateCreated
Desc"
RS.Open RSSQL, Conn, 1, 3
ElseIf request("Action ") = "Ask2" Then
Set RS = Server.CreateOb ject("ADODB.Rec ordset")
RS.Open "Questions" , Conn, 2, 2
RS.addnew
RS("Question") = Request("Questi on")
RS("Category") = Request("Catego ry")
RS("DateCreated ") = Date
RS("Pending") = True
RS.update
End If
%>
Working script using access http://www.alfa-it.co.uk/faq/default.asp
(windows host)
Almost working script using mysql
http://www.automateyourgates.co.uk/faq/default.asp (apache host)
Any help much appreciated
Thanks
Chris.