View Full Version : display data
how to display data's from database in a form....my system works like. this.admin have to key in the student's registration number..and the system should be able to search the complete record of the student...n display all info abt the student in a form using asp..plz help...
BuildHome
08-06-03, 04:40 AM
First of all, you know to display normal data ?
BuildHome
08-06-03, 04:52 AM
OK, great.
Now you only need to build a form, like this one:
<form action="search_action.asp" method="post">
Keyword:<br>
<input type="text" size="25" name="keyword">
<input type="submit" value="Search!">
</form>
Let's say that your search page Is "search_action.asp".
Write (or copy) this code:
<%
keyword = Request.Form("KeyWord")
SQL = "Select * from tbl where body='%"&keyword&"%';"
%>
And this will display all the data that like the keyword value from the form.
OK ?
:)
Originally posted by BuildHome
OK, great.
Now you only need to build a form, like this one:
<form action="search_action.asp" method="post">
Keyword:<br>
<input type="text" size="25" name="keyword">
<input type="submit" value="Search!">
</form>
Let's say that your search page Is "search_action.asp".
Write (or copy) this code:
<%
keyword = Request.Form("KeyWord")
SQL = "Select * from tbl where body='%"&keyword&"%';"
%>
And this will display all the data that like the keyword value from the form.
OK ?
:)
You also should check for commas and things like that in the keyword variable. If you don't, you are just asking for SQL injection.
instead of talking about it, show them :P ;)
<%
keyword = Request.Form("KeyWord")
keyword = Replace(keyword, "'" "''", 1, -1, 1)
SQL = "Select * from tbl where body='%" & keyword & "%';"
%>
Originally posted by MadDog
instead of talking about it, show them :P ;)
<%
keyword = Request.Form("KeyWord")
keyword = Replace(keyword, "'" "''", 1, -1, 1)
SQL = "Select * from tbl where body='%" & keyword & "%';"
%>
I didn't have the time. I was at work.
vBulletin® v3.6.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.