i would like to create FAQ webpage so i create database and link it with website but my questions is...?
in main page i will list all the question in database like this
http://home.stoik.com/uploaded/faq1.jpg
but i wanna make the name of the problem hyper link when i press on the name i will go to page that will list the detail for the problem and i can add reply like any FAQ
how can i make please
the FAQ main page has this code
All you're selecting is the FAQ Title, so there's nothing to link to in your case. You also do a Response.Write("Subject") but there's no Subject field in your query and you don't even have one in your database. But those are beside the point. You would
need to link to a new page that accepted the FAQTitle (it would be better if you selected and passed the FAQID or other unique key) as a form input and queried the database for the FAQBody. Your code might have something like this:
Page1.asp
==========
<%
selectSQL="select faqid, faqtitle from faq order by faqid desc"
set rs=con.execute(selectSQL)
do while not rs.eof
Response.Write "<a href='http:\\www.sample.com\page2.asp?faqid=" & rs("faqid") & "'>" & rs("faqtitle") & "</a><br>"
loop
%>
Page2.asp
============
<%
faqid = Request.QueryString(faqid)
selectSQL="select faqtitle, faqbody from faq where faqid='" & faqid & "'""
set rs=con.execute(selectSQL)
do while not rs.eof
Response.Write rs("faqtitle") & "<br>"
Response.Write rs("faqbody")
loop
%>
Please note I haven't tested the code and it needs formatting, HTML, etc. to run, as well as link information. But it should give you an idea of how it could be done.
jeff i have problem with second code the error said "
Expecting string input
/faqdetails.asp, line 17
The function expects a string as input. "
also i would like to provide reply from anthor table so the command for query must include the table for reply
this the code for faqdetail which has question and subject and reply
%>
<p align="center"><font face="Simplified Arabic"><a href="add_reply.asp">add
your </a></font><font face="Simplified Arabic"><a href="add_reply.asp">reply</a></font></p>
<!--#include file="pagefooter.txt" -->
-------------------------------------------------------------------
the database has two table
faq(
faqid:AutoNumber
faqtitle:text
faqbody:memo
)
reply(
replyid:AutoNumber
reply:memo
faqid:Number
)
so don't forget this code in table
v v v
v v
v
<tr>
<td width="100%" dir="ltr" bgcolor="#E6E6D5"><b><% Response.Write ("Reply") %> <% = "Reply" %></b></td>
</tr>
jeff i have problem with second code the error said "
Expecting string input
/faqdetails.asp, line 17
The function expects a string as input. "
Not sure what line 17 is (My code has far fewer than 17 lines...), but my guess is your FAQID is numeric. You need to convert to a string or process it as a numeric. Might use something like:
faqid = CStr(Request.QueryString(faqid))
Check devguru.com for a decent refernece of commands.
abo_ashwaag
also i would like to provide reply from anthor table so the command for query must include the table for reply
this the code for faqdetail which has question and subject and reply
Then you need a foreign key in that table that can be referenced in your query. Change your query to account for the additional tables, and use a JOIN. You can learn query language by looking at sqlcourse.com, or if you use Access yu can create a query with
the wizards then view it as code.
%>
<p align="center"><font face="Simplified Arabic"><a href="add_reply.asp">add
your </a></font><font face="Simplified Arabic"><a href="add_reply.asp">reply</a></font></p>
<!--#include file="pagefooter.txt" -->
---------------------
so i will this all the reply now but i would like to all the title also ans body i mean the question so i have to add this code
i have to change
selectSQL="select * from reply where faqid=" & Request.QueryString("faqid")
because this code will provide just reply table and the title and the bosy in the other table called faq
so i wanna this help plz
i have to change
selectSQL="select * from reply where faqid=" & Request.QueryString("faqid")
because this code will provide just reply table and the title and the bosy in the other table called faq
so i wanna this help plz
That's a SQL JOIN command. You'll need to learn these if you're ever going to do anything useful in SQL. Take a look at sqlcourse.com and work through the examples. Your SQL statement will end up something like:
selectSQL="SELECT faq.faqtitle, faq.faqbody, reply.reply FROM faq JOIN reply ON faq.faqid = reply.faqid WHERE faq.faqid = " & Request.QueryString("faqid")
If you're using Access, develop the query in the GUI and paste it to your code. You can also paste your query into Access and run it and see what the result is.
dear jeff
i already created a new SQL statement in access and i used it
"
selectSQL="select faq.faqtitle, faq.faqbody, reply.reply
FROM faq INNER JOIN reply ON faq.faqid = reply.faqid where faqid=" & Request.QueryString("faqid")
"
but i got this message
" The specified field 'faqid' could refer to more than one table listed in the FROM clause of your SQL statement.
/faqdetails.asp, line 13
"
so what can i do i am sorry for annoying you
but u r my teacher :$
Dear jeff
thank you for helping me actually it's work now
i made some change the statement became
"
dim id
id = Request.QueryString("faqid")
selectSQL="select faq.faqtitle, faq.faqbody, reply.reply FROM faq INNER JOIN reply ON faq.faqid = reply.faqid where faq.faqid and reply.faqid ="&id
"
but i have problem now
if you take a look at this pic http://www.uparab.com/File/1126515969.jpg
you will see all the questions but if i access to the question that had already reply like "questions in iomss"
i will get these data http://www.uparab.com/File/1126516052.jpg
so the problem still here
"
selectSQL="select faq.faqtitle, faq.faqbody, reply.reply FROM faq INNER JOIN reply ON faq.faqid = reply.faqid where faq.faqid and reply.faqid ="&id
"
because this part of statement "where faq.faqid and reply.faqid ="&id "
if i add a new question in faq tablei have to fill faq.faqid ,faqtitle and faqbody so I will fill this column faq.faqid
but the reply.faqid column on reply table will be empty until i add reply
so what can i do
thanks and my regards
13 Posts
how can i make link
Aug 30, 2005 06:38 AM|abo_ashwaag|LINK
i would like to create FAQ webpage so i create database and link it with website but my questions is...?
in main page i will list all the question in database like this
http://home.stoik.com/uploaded/faq1.jpg
but i wanna make the name of the problem hyper link when i press on the name i will go to page that will list the detail for the problem and i can add reply like any FAQ
how can i make please
the FAQ main page has this code
""""""""""""""""""""""""""""
<%@ Language=VBScript CodePage = "1256"%>
<html>
<!--#include file="pageheader.txt" -->
<p align="center"><font face="Simplified Arabic">wlcome in Frequently Asked Questions </font></p>
<p align="center"><font face="Simplified Arabic"><a href="sign_book.asp">add your questions</a></font></p>
<!--#include file="connection.txt" -->
<%
selectSQL="select faqtitle from faq order by faqid desc"
set rs=con.execute(selectSQL)
do while not rs.eof
%>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%">
<tr>
<td width="100%" dir="ltr" bgcolor="#DFDFFF"><b><font color="#0066CC"><%response.write ("Subject")%></font>: <font color="#7A7A7A"><%response.write rs("faqtitle")%></font></b></td>
</tr>
</table>
</center>
</div>
<hr color="#DFDFFF" width="90%">
<hr color="#FFEAD5" width="85%" size="1">
<%
rs.movenext
loop
con.close
%><!--#include file="pagefooter.txt" -->
""""""""""""""""""""""""""""""""""""""""""
and the database has two table
faq (faqid,faqtitle,faqbody)
reply(replyid,reply,faqid)
my regards
4640 Posts
Re: how can i make link
Aug 30, 2005 02:33 PM|jeff@zina.com|LINK
All you're selecting is the FAQ Title, so there's nothing to link to in your case. You also do a Response.Write("Subject") but there's no Subject field in your query and you don't even have one in your database. But those are beside the point. You would need to link to a new page that accepted the FAQTitle (it would be better if you selected and passed the FAQID or other unique key) as a form input and queried the database for the FAQBody. Your code might have something like this:
Page1.asp
==========
<%
selectSQL="select faqid, faqtitle from faq order by faqid desc"
set rs=con.execute(selectSQL)
do while not rs.eof
Response.Write "<a href='http:\\www.sample.com\page2.asp?faqid=" & rs("faqid") & "'>" & rs("faqtitle") & "</a><br>"
loop
%>
Page2.asp
============
<%
faqid = Request.QueryString(faqid)
selectSQL="select faqtitle, faqbody from faq where faqid='" & faqid & "'""
set rs=con.execute(selectSQL)
do while not rs.eof
Response.Write rs("faqtitle") & "<br>"
Response.Write rs("faqbody")
loop
%>
Please note I haven't tested the code and it needs formatting, HTML, etc. to run, as well as link information. But it should give you an idea of how it could be done.
Jeff
9750 Posts
MVP
Re: how can i make link
Aug 30, 2005 04:55 PM|tomkmvp|LINK
13 Posts
Re: how can i make link
Aug 31, 2005 02:17 AM|abo_ashwaag|LINK
thank you so much jeff and tomkmvp for helping me
jeff i have problem with second code the error said "
Expecting string input
/faqdetails.asp, line 17
The function expects a string as input. "
also i would like to provide reply from anthor table so the command for query must include the table for reply
this the code for faqdetail which has question and subject and reply
--------------------------------------------------
<%@ Language=VBScript CodePage = "1256"%>
<html>
<!--#include file="pageheader.txt" -->
<p align="center"><font face="Simplified Arabic">wlcome in Frequently Asked Questions </font></p>
<!--#include file="connection.asp" -->
<%
faqid = Request.QueryString(faqid)
selectSQL="select faqtitle, faqbody from faq where faqid='" & faqid & "'"
set rs=con.execute(selectSQL)
do while not rs.eof
%>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%">
<tr>
<td width="100%" dir="ltr" bgcolor="#DFDFFF"><b><% Response.Write ("faqtitle") %> <% = "faqtitle" %></b></td>
</tr>
<tr>
<td width="100%" dir="ltr" bgcolor="#FFFFFF"><b><% Response.Write ("faqbody") %> <% = "faqbody" %></b></td>
</tr>
</table>
</center>
</div>
<hr color="#DFDFFF" width="90%">
<hr color="#FFEAD5" width="85%" size="1">
<%
rs.movenext
loop
con.close
%>
<p align="center"><font face="Simplified Arabic"><a href="add_reply.asp">add
your </a></font><font face="Simplified Arabic"><a href="add_reply.asp">reply</a></font></p>
<!--#include file="pagefooter.txt" -->
-------------------------------------------------------------------
the database has two table
faq(
faqid:AutoNumber
faqtitle:text
faqbody:memo
)
reply(
replyid:AutoNumber
reply:memo
faqid:Number
)
so don't forget this code in table
v v v
v v
v
<tr>
<td width="100%" dir="ltr" bgcolor="#E6E6D5"><b><% Response.Write ("Reply") %> <% = "Reply" %></b></td>
</tr>
thank and regards
4640 Posts
Re: how can i make link
Aug 31, 2005 07:41 AM|jeff@zina.com|LINK
Not sure what line 17 is (My code has far fewer than 17 lines...), but my guess is your FAQID is numeric. You need to convert to a string or process it as a numeric. Might use something like:
faqid = CStr(Request.QueryString(faqid))
Check devguru.com for a decent refernece of commands.
Then you need a foreign key in that table that can be referenced in your query. Change your query to account for the additional tables, and use a JOIN. You can learn query language by looking at sqlcourse.com, or if you use Access yu can create a query with the wizards then view it as code.Jeff
13 Posts
Re: how can i make link
Sep 04, 2005 01:58 AM|abo_ashwaag|LINK
thanks jeff for your helping
actually i already made faq web page it's ok now and this is the code
-----------------------------
<%@ Language=VBScript CodePage = "1256"%>
<html>
<!--#include file="pageheader.txt" -->
<p align="center"><font face="Simplified Arabic">wlcome in Frequently Asked Questions </font></p>
<p align="center"><font face="Simplified Arabic"><a href="add_question.asp">add your questions</a></font></p>
<!--#include file="connection.asp" -->
<%
selectSQL="select faqid, faqtitle from faq order by faqid desc"
set rs=con.execute(selectSQL)
do while not rs.eof
%>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%">
<tr>
<td width="100%" dir="ltr" bgcolor="#DFDFFF">
<b><font color="#0066CC"><%response.write ("Subject")%></font>:
<font color="#7A7A7A">
<a href="faqdetails.asp?faqid=<% = rs("faqid") %>"><%response.write rs("faqtitle")%></a></font></b></td>
</tr>
</table>
</center>
</div>
<hr color="#DFDFFF" width="90%">
<hr color="#FFEAD5" width="85%" size="1">
<%
rs.movenext
loop
con.close
%><!--#include file="pagefooter.txt" -->
------------------------
but when i choose the subject and i click on the hyper link i will go to faqdetail
so this page has this code
---------------
<%@ Language=VBScript CodePage = "1256"%>
<html>
<!--#include file="pageheader.txt" -->
<p align="center"><font face="Simplified Arabic">wlcome in Frequently Asked Questions </font></p>
<!--#include file="connection.asp" -->
<%
selectSQL="select * from reply where faqid=" & Request.QueryString("faqid")
set rs=con.execute(selectSQL)
do while not rs.eof
%>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%">
<tr>
<td width="100%" dir="ltr" bgcolor="#E6E6D5"><b><% Response.Write ("Reply") %> <% = "Reply" %></b></td>
</tr>
</table>
</center>
</div>
<hr color="#DFDFFF" width="90%">
<hr color="#FFEAD5" width="85%" size="1">
<%
rs.movenext
loop
con.close
%>
<p align="center"><font face="Simplified Arabic"><a href="add_reply.asp">add
your </a></font><font face="Simplified Arabic"><a href="add_reply.asp">reply</a></font></p>
<!--#include file="pagefooter.txt" -->
---------------------
so i will this all the reply now but i would like to all the title also ans body i mean the question so i have to add this code
<tr>
<td width="100%" dir="ltr" bgcolor="#DFDFFF"><b><% Response.Write ("faqtitle") %> <% = "faqtitle" %></b></td>
</tr>
<tr>
<td width="100%" dir="ltr" bgcolor="#FFFFFF"><b><% Response.Write ("faqbody") %> <% = "faqbody" %></b></td>
</tr>
----------------------
i have to change
selectSQL="select * from reply where faqid=" & Request.QueryString("faqid")
because this code will provide just reply table and the title and the bosy in the other table called faq
so i wanna this help plz
my regards
4640 Posts
Re: how can i make link
Sep 06, 2005 11:18 AM|jeff@zina.com|LINK
selectSQL="SELECT faq.faqtitle, faq.faqbody, reply.reply FROM faq JOIN reply ON faq.faqid = reply.faqid WHERE faq.faqid = " & Request.QueryString("faqid")
Jeff
13 Posts
Re: how can i make link
Sep 10, 2005 09:21 AM|abo_ashwaag|LINK
Dear jeff
Thanks for helping me in fact when i used your SQL statement i found this message from page
"
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in FROM clause.
/faqdetails.asp, line 11
"
i will list the header for this page
-------------------
<%@ Language=VBScript CodePage = "1256"%>
<!--#include file="pageheader.txt" -->
<p align="center"><font face="Simplified Arabic">wlcome in Frequently Asked Questions </font></p>
<!--#include file="connection.asp" -->
<%
selectSQL="select faq.faqtitle,faq.faqbody,reply.reply from faq join reply on faq.faqid=reply.faqid where faqid=" & Request.QueryString("faqid")
set rs=con.execute(selectSQL)
do while not rs.eof
%>
-------------------------
i don't know why there is an error in the page can i have the hand please
my regards
4640 Posts
Re: how can i make link
Sep 10, 2005 12:54 PM|jeff@zina.com|LINK
If you're using Access, develop the query in the GUI and paste it to your code. You can also paste your query into Access and run it and see what the result is.
Jeff
13 Posts
Re: how can i make link
Sep 11, 2005 05:01 AM|abo_ashwaag|LINK
dear jeff
i already created a new SQL statement in access and i used it
"
selectSQL="select faq.faqtitle, faq.faqbody, reply.reply
FROM faq INNER JOIN reply ON faq.faqid = reply.faqid where faqid=" & Request.QueryString("faqid")
"
but i got this message
"
The specified field 'faqid' could refer to more than one table listed in the FROM clause of your SQL statement.
/faqdetails.asp, line 13
"
so what can i do i am sorry for annoying you
but u r my teacher :$
4640 Posts
Re: how can i make link
Sep 11, 2005 10:16 AM|jeff@zina.com|LINK
Try:
selectSQL="select faq.faqtitle, faq.faqbody, reply.reply FROM faq INNER JOIN reply ON faq.faqid = reply.faqid where faq.faqid=" & Request.QueryString("faqid")
Jeff
13 Posts
Re: how can i make link
Sep 12, 2005 01:18 AM|abo_ashwaag|LINK
dear jeff
stil there is a probelm in the statement
i think the problem here
faq.faqid = reply.faqid
13 Posts
Re: how can i make link
Sep 12, 2005 05:45 AM|abo_ashwaag|LINK
Dear jeff
thank you for helping me actually it's work now
i made some change the statement became
"
dim id
id = Request.QueryString("faqid")
selectSQL="select faq.faqtitle, faq.faqbody, reply.reply FROM faq INNER JOIN reply ON faq.faqid = reply.faqid where faq.faqid and reply.faqid ="&id
"
but i have problem now
if you take a look at this pic
http://www.uparab.com/File/1126515969.jpg
you will see all the questions but if i access to the question that had already reply like "questions in iomss"
i will get these data
http://www.uparab.com/File/1126516052.jpg
but if i select question that already created like "what does ODS mean"
http://www.uparab.com/File/1126516083.jpg
i will not find the questions and the subject until i add new reply
http://www.uparab.com/File/1126516109.jpg
so the problem still here
"
selectSQL="select faq.faqtitle, faq.faqbody, reply.reply FROM faq INNER JOIN reply ON faq.faqid = reply.faqid where faq.faqid and reply.faqid ="&id
"
because this part of statement "where faq.faqid and reply.faqid ="&id "
if i add a new question in faq tablei have to fill faq.faqid ,faqtitle and faqbody so I will fill this column faq.faqid
but the reply.faqid column on reply table will be empty until i add reply
so what can i do
thanks and my regards