Linking to Correct record to edit (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


steveg -> Linking to Correct record to edit (7/18/2007 10:20:49)

I have a search page which has a link for editing against each record. When I hover over the link for a particular record, it shows the relevant record id, however, when you choose the link it takes you to the first record in the file and yet when I select the edit link for record 2 the URL shows as:

http://www.teaching-uk.com/vacancy/edit_record.asp?ID=2


which would appear to be the right record?

The search page is as follows:
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit.
FP_CharSet = "windows-1252"
FP_CodePage = 1252 %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Display all Vacancies View all current vacancies and choose a record to 
edit if required</title>
</head>

<body>

<p><b><font color="#000080" face="Verdana" size="5">Display all Vacancies<br>
</font></b><font face="Verdana" size="2">View all current vacancies and choose a 
record to edit if required</font></p>
<!--webbot bot="DatabaseRegionStart" s-columnnames="ID,JobTitle,Location,JobDescription,Active,Notes,Remote_computer_name,User_name,Browser_type,Timestamp" s-columntypes="3,202,202,203,202,203,202,202,202,135" s-dataconnection="add_a_vacancy" b-tableformat="FALSE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="5" b-makeform="TRUE" s-recordsource="Results" s-displaycolumns="ID,JobTitle,Location,JobDescription,Active,Notes,Timestamp" s-criteria s-order="[Timestamp] + [JobTitle] +" s-sql="SELECT * FROM Results ORDER BY Timestamp ASC,JobTitle ASC" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="0" botid="0" u-dblib="../_fpclass/fpdblib.inc" u-dbrgn1="../_fpclass/fpdbrgn1.inc" u-dbrgn2="../_fpclass/fpdbrgn2.inc" tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00" align="left"><font color="#000000">This is the start of a Database Results region.</font></td></tr></table>" startspan --><!--#include file="../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Results ORDER BY Timestamp ASC,JobTitle ASC"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="add_a_vacancy"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_iDisplayCols=7
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="58748" --><table BORDER="1">
  <tr>
    <td width="114" bgcolor="#66CCFF"><font face="Verdana" size="2"><b>ID</b></font></td>
    <td width="496"><font face="Verdana" size="2">
    <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,JobTitle,Location,JobDescription,Remote_computer_name,User_name,Browser_type,Timestamp,Active,Notes" s-column="ID" b-tableformat="FALSE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>ID<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"ID")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="62813" --></font></td>
  </tr>
  <tr>
    <td width="114" bgcolor="#66CCFF"><font face="Verdana" size="2"><b>Job Title</b></font></td>
    <td width="496"><b><font face="Verdana" size="2" color="#000080">
    <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,JobTitle,Location,JobDescription,Remote_computer_name,User_name,Browser_type,Timestamp,Active,Notes" s-column="JobTitle" b-tableformat="FALSE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>JobTitle<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"JobTitle")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="16244" --></font></b></td>
  </tr>
  <tr>
    <td width="114" bgcolor="#66CCFF"><font face="Verdana" size="2"><b>Location</b></font></td>
    <td width="496"><font face="Verdana" size="2">
    <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,JobTitle,Location,JobDescription,Remote_computer_name,User_name,Browser_type,Timestamp,Active,Notes" s-column="Location" b-tableformat="FALSE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Location<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Location")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="16691" --></font></td>
  </tr>
  <tr>
    <td width="114" bgcolor="#66CCFF"><font face="Verdana" size="2"><b>Job 
    Description</b></font></td>
    <td width="496"><font face="Verdana" size="2">
    <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,JobTitle,Location,JobDescription,Remote_computer_name,User_name,Browser_type,Timestamp,Active,Notes" s-column="JobDescription" b-tableformat="FALSE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>JobDescription<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"JobDescription")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="43741" --></font></td>
  </tr>
  <tr>
    <td width="114" bgcolor="#66CCFF"><font face="Verdana" size="2"><b>Date 
    Added</b></font></td>
    <td width="496"><font face="Verdana" size="2">
    <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,JobTitle,Location,JobDescription,Remote_computer_name,User_name,Browser_type,Timestamp,Active,Notes" s-column="Timestamp" b-tableformat="FALSE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Timestamp<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Timestamp")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="20579" --></font></td>
  </tr>
  <tr>
    <td width="114" bgcolor="#66CCFF"><font face="Verdana" size="2"><b>Active</b></font></td>
    <td width="496"><font face="Verdana" size="2">
    <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,JobTitle,Location,JobDescription,Remote_computer_name,User_name,Browser_type,Timestamp,Active,Notes" s-column="Active" b-tableformat="FALSE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Active<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Active")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="13739" --></font></td>
  </tr>
  <tr>
    <td width="114" bgcolor="#66CCFF"><font face="Verdana" size="2"><b>Notes</b></font></td>
    <td width="496"><font face="Verdana" size="2">
    <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,JobTitle,Location,JobDescription,Remote_computer_name,User_name,Browser_type,Timestamp,Active,Notes" s-column="Notes" b-tableformat="FALSE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Notes<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Notes")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="9199" --></font></td>
  </tr>
  <tr>
    <td width="238" bgcolor="#FFFFFF">
    <p align="center"><b><font face="Tahoma" size="2">
    <a href="edit_record.asp?ID=<%=FP_FieldURL(fp_rs,"ID")%>">Edit Record</a></font></b></td>
    <td width="372" bgcolor="#FFFFFF">
    <p align="center"><b><font face="Tahoma" size="2">
    <a target="_top" href="index_vacancy_management_menu.htm">Back to Vacancy Main 
    Menu</a></font></b></td>
  </tr>
</table>
<hr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="FALSE" u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00" align="left"><font color="#000000">This is the end of a Database Results region.</font></td></tr></table>" startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" --><p> </p>

</body>

</html>


and the edit page is as follows:
<html>

<head>
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit.
FP_LCID = 2057 %>
<meta http-equiv="Content-Language" content="en-gb">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit.
FP_CharSet = "windows-1252"
FP_CodePage = 1252 %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Edit Record Make Changes to your vacancy Remember you need to change the 
date if you would like the item to appear at the top again</title>
</head>

<body>

<p><img border="0" src="../images/teaching_jobs_uk_title.jpg"></p>
<p><b><font face="Verdana" size="5" color="#000080">Edit Record<br>
</font></b><font face="Verdana" size="2">Make Changes to your vacancy<br>
Remember you need to change the date if you would like the item to appear at the 
top again</font></p>

<!--webbot bot="DatabaseRegionStart" s-columnnames="ID,JobTitle,Location,JobDescription,Active,Notes,Remote_computer_name,User_name,Browser_type,Timestamp" s-columntypes="3,202,202,203,202,203,202,202,202,135" s-dataconnection="add_a_vacancy" b-tableformat="FALSE" b-menuformat="FALSE" s-menuchoice="ID" s-menuvalue="ID" b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="7" b-makeform="TRUE" s-recordsource="Results" s-displaycolumns="ID,JobTitle,Location,JobDescription,Active,Notes,Timestamp" s-criteria s-order s-sql="SELECT * FROM Results" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records returned." i-maxrecords="1" i-groupsize="1" botid="0" u-dblib="../_fpclass/fpdblib.inc" u-dbrgn1="../_fpclass/fpdbrgn1.inc" u-dbrgn2="../_fpclass/fpdbrgn2.inc" tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00" align="left"><font color="#000000">This is the start of a Database Results region.</font></td></tr></table>" startspan b-WasTableFormat="FALSE" --><!--#include file="../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Results"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="add_a_vacancy"
fp_iMaxRecords=1
fp_iCommandType=1
fp_iPageSize=1
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice="ID"
fp_sMenuValue="ID"
fp_iDisplayCols=7
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="31870" --><form METHOD="POST" action="post_record.asp">
  <p>
  <!--webbot bot="PurpleText" preview="Set this form's properties so it submits user input to the appropriate page." --></p>
  <table BORDER="0">
    <tr>
      <td bgcolor="#66CCFF" width="179"><font face="Verdana" size="2"><b>Job 
      Title</b></font></td>
      <td width="515">
      <font face="Verdana">
      <input TYPE="TEXT" NAME="JobTitle" SIZE="40" VALUE="<%=FP_FieldHTML(fp_rs,"JobTitle")%>"></font></td>
    </tr>
    <tr>
      <td bgcolor="#66CCFF" width="179"><font face="Verdana" size="2"><b>
      Location</b></font></td>
      <td width="515">
      <font face="Verdana">
      <input TYPE="TEXT" NAME="Location" SIZE="40" VALUE="<%=FP_FieldHTML(fp_rs,"Location")%>"></font></td>
    </tr>
    <tr>
      <td bgcolor="#66CCFF" width="179"><font face="Verdana" size="2"><b>Job 
      Description</b></font></td>
      <td width="515">
      <font face="Verdana">
      <textarea rows="4" name="JobDescription" cols="60" style="font-family: Verdana; font-size: 10pt"><%=FP_FieldHTML(fp_rs,"JobDescription")%></textarea></font></td>
    </tr>
    <tr>
      <td bgcolor="#66CCFF" width="179"><font face="Verdana" size="2"><b>
      Timestamp</b></font></td>
      <td width="515">
      <font face="Verdana">
      <input NAME="Timestamp" SIZE="40" VALUE="<%=FP_FieldHTML(fp_rs,"Timestamp")%>"></font></td>
    </tr>
    <tr>
      <td bgcolor="#66CCFF" width="179"><font face="Verdana" size="2"><b>Active</b></font></td>
      <td width="515">
      <p>
      <select size="1" name="Active"> 
<option value="Active" <%If FP_FieldHTML(fp_rs,"Active")="Active" Then Response.write(" selected") End If%>>
Active</option> 
<option value="Inactive" <%If FP_FieldHTML(fp_rs,"Active")="Inactive" Then Response.write(" selected") End If%>>
Inactive</option> 
</select></td>
    </tr>
    <tr>
      <td bgcolor="#66CCFF" width="179"><font face="Verdana" size="2"><b>Notes</b></font></td>
      <td width="515">
      <font face="Verdana">
      <input TYPE="TEXT" NAME="Notes" SIZE="40" VALUE="<%=FP_FieldHTML(fp_rs,"Notes")%>"></font></td>
    </tr>
    <tr>
      <td COLSPAN="2"><br>
      <input TYPE="submit" NAME="fp_submit" value="Update"><input TYPE="Reset" NAME="fp_reset"></td>
    </tr>
  </table>
  <input type="hidden" name="ID" value="<%=Request("ID")%>">
</form>
<hr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="FALSE" u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00" align="left"><font color="#000000">This is the end of a Database Results region.</font></td></tr></table>" startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" --><p align="center">
<b><font face="Tahoma" size="2">
<a target="_top" href="index_vacancy_management_menu.htm">Back to Vacancy Main Menu</a></font></b></p>

</body>

</html>


Any thoughts?

Steve




Spooky -> RE: Linking to Correct record to edit (7/18/2007 16:11:34)

The edit page has an SQL :

fp_sQry="SELECT * FROM Results"

It should be this, so it knows which number to query :

fp_sQry="SELECT * FROM Results WHERE ID=::ID::"




steveg -> RE: Linking to Correct record to edit (7/18/2007 16:34:45)

Spooky

To the point and spot on as usual.

Thank you.

Steve




BeTheBall -> RE: Linking to Correct record to edit (7/18/2007 17:17:38)

He stole my answer. [;)]




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.078125