Forums

This topic is locked

adding a field

Posted 30 May 2003 13:36:15
1
has voted
30 May 2003 13:36:15 les swift posted:
I am having problems with my site. The thing is that when the site was created the company didn't want prices included in the database and now 3 months down the line they want the results page to display the prices. I have added the prices to the database but I am at a loss in getting ultradev to show the results in the page. Can any one help with this. I am using an access database. the site in particular is www.ohara-motors.co.uk if you go to the site and look at the code and tell me what to do. thanks Les. here is the code of the results page as requested. <html>
<head>
<!-- #BeginEditable "doctitle" -->
<title>::: James O'Hara Motors - Search Results :::</title>
<!-- #EndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../ohara.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="700" border="0" cellpadding="0" cellspacing="0" align="center" background="../images/titlebg.gif" class="title">
<tr>
<td width="132" height="47"></td>
<td valign="middle" colspan="7" class="title">
<div align="center">James O'Hara & Sons Motors </div>
</td>
</tr>
<tr>
<td height="29" width="132"></td>
<td width="154"></td>
<td width="1"></td>
<td valign="middle" colspan="4" class="logoTxt">
<div align="right">cars bought sold and exchanged</div>
</td>
<td width="23"></td>
</tr>
<tr>
<td height="39" width="132"></td>
<td valign="middle" class="qSearchTxt" width="154">
<div align="right"></div>
</td>
<td width="1"></td>
<form name="Searchfm" method="post" action="results/results.asp">
<td width="24" align="right">
<td width="118" valign="middle">  </td>
<td width="96" valign="middle">  </td>
<td width="152" valign="middle">  </td>
<td valign="top" colspan="2" width="23">  </td>
</FORM>
</tr>
<tr>
<td height="1" width="132"></td>
<td width="154"></td>
<td width="1"></td>
<td width="24"></td>
<td width="118"></td>
<td width="96"></td>
<td width="152"></td>
<td width="23"></td>
</tr>
</table>
<!-- #BeginEditable "mainTxt" -->
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/stock.asp" -->
<!--#include file="../Connections/stock.asp" -->
<%

Const SRPAGEUPPERBOUNDARY = "srpageupperboundary"
Const SRLASTPAGEVIEWED = "srlastpageviewed"
Const SRMOREAFTERLASTPAGE = "srmoreafterlastpage"
Const SRMAKE = "make"
Const SRYEAR = "year"
Const SRPAGED = "srpaged"

Dim make
Dim year
Dim whereclause
Dim fullQuery
Dim page
Dim showpage
Dim count
Dim displaypagelinks
Dim refno
Dim i
Dim checkForEnd

checkForEnd = False
displaypagelinks = false

page = Request.Querystring("page"
showpage = Len(page) > 0
page=CInt(page)

If showpage Then
make = session(SRMAKE)
year = session(SRYEAR)

whereclause = ""
If page = 1 Then
whereclause = "WHERE (Ref_No<=" & session(SRPAGEUPPERBOUNDARY&"1" & ""
Else
If page <= session(SRLASTPAGEVIEWED) Then
whereclause = "WHERE (Ref_No>" & session(SRPAGEUPPERBOUNDARY & (page-1)) & " AND (Ref_No<=" & session(SRPAGEUPPERBOUNDARY & page) & ""
Else
'in here it must be the page immediately after the lastpageviewed
checkForEnd = True
whereclause = "WHERE (Ref_No>" & session(SRPAGEUPPERBOUNDARY & session(SRLASTPAGEVIEWED)) & ""
session(SRLASTPAGEVIEWED ) = page
session(SRMOREAFTERLASTPAGE) = False
End If
End If
If make <> "Any" Then
whereclause = whereclause & " AND make='" & make & "'"
End If
If year <> "Any" Then
whereclause = whereclause & " AND year='" & year & "'"
End If
If Not checkForEnd Then
fullQuery = "SELECT * FROM CARS " & whereclause
Else
fullQuery = "SELECT TOP 11 * FROM CARS " & whereclause
End If
Else
make = Request.Form("make"
year = Request.Form("year"
whereclause = ""
If make <> "Any" Then
whereclause = "WHERE make='" & make & "'"
End If
If year <> "Any" Then
If make <> "Any" Then
whereclause = whereclause & " AND year='" & year & "'"
Else
whereclause = "WHERE year='" & year & "'"
End If
End If
fullQuery = "SELECT TOP 11 * FROM CARS " & whereclause

session(SRMAKE) = make
session(SRYEAR) = year
session(SRPAGED) = False 'set to false initially and then if there are more than 10 can reset
session(SRMOREAFTERLASTPAGE) = False
page = 1
End If

fullquery = fullquery & " ORDER BY Ref_No"

set search_results = Server.CreateObject("ADODB.Recordset"
search_results.ActiveConnection = MM_stock_STRING
search_results.Source = fullQuery
search_results.CursorType = 0
search_results.CursorLocation = 2
search_results.LockType = 3
search_results.Open()

%>
<table align="center" width="676" height="84">
<tr>
<td width="145" height="40" valign="centre">
<div align="center">Ref No.</div>
</td>
<td width="3"></td>
<td width="100">Make</td>
<td width="100">Model </td>
<td width="100">Colour </td>
<td width="100">Year</td>
<td width="75">Insurance Group</td>
<td>Price</td>
<td></td>
</tr>
<%

If search_results.EOF Then
%>
<tr>
<td colspan=7 height="21" valign="top"><i>Sorry, no cars match your search
criteria.</i></td>
<td></td>
<td></td>
</tr>
<%
Else
count = 0 'count means how many have been dsiplayed already
Do While NOT search_results.EOF
refno = search_results.Fields.Item("Ref_No".Value
%>
<tr>
<td height="21" colspan="2"><font size="2"><%=refno%></font></td>
<td><font size="2"><%=(search_results.Fields.Item("Make".Value)%></font></td>
<td><font size="2"><%=(search_results.Fields.Item("Model".Value)%></font></td>
<td><font size="2"><%=(search_results.Fields.Item("Colour".Value)%></font></td>
<td><font size="2"><%=(search_results.Fields.Item("Year".Value)%></font></td>
<td><font size="2"><%=(search_results.Fields.Item("Insurance Group".Value)%></font></td>
<td><font size="2"><%=(search_results.Fields.Item("Price".Value)%></font></td>
<td></td>
</tr>
<%
search_results.MoveNext()
count = count + 1
If showpage and checkForEnd And (count=10) And Not search_results.EOF Then
session(SRMOREAFTERLASTPAGE) = True
End If
If Not showpage And (count=10) And Not search_results.EOF Then
'OK, we want to page these results
displaypagelinks = True
session(SRPAGEUPPERBOUNDARY&"1" = refno
session(SRLASTPAGEVIEWED ) = 1
session(SRMOREAFTERLASTPAGE) = True
session(SRPAGED) = True
Exit Do
End If
Loop
If showpage and checkForEnd Then
session(SRPAGEUPPERBOUNDARY&page) = refno
End If
End If
%>
</table>
<p align="center" class="txt">
<%
If session(SRPAGED) Then
response.Write "pages: "
For i = 1 to session(SRLASTPAGEVIEWED)
If i <> page Then
response.Write "<a href=""results.asp?page=" & i & """>" & i & " </a>"
Else
response.Write "" & i & " "
End If
Next
If session(SRMOREAFTERLASTPAGE) Then
response.Write "<a href=""results.asp?page=" & (session(SRLASTPAGEVIEWED)+1) & """>next</a>"
End If
End If
%>
</p>
<p align="center" class="txt">For a quote, enter the car's Ref number and other
details here <a href="/About/pricequery.htm"><font size="2"> Price Query</font></a></p>
<!-- #EndEditable -->
<p align="center" class="txt"><a href="/Index.htm"><font size="2">New Search</font></a></p>
<p></p>
<p> </p>
<!-- #BeginEditable "navBar" -->
<table width="700" border="0" cellpadding="0" cellspacing="0" align="center" background="../images/footerbg.gif">
<tr>
<td width="46" height="13"></td>
<td width="47"></td>
<td width="68"></td>
<td width="35"></td>
<td width="25"></td>
<td width="59"></td>
<td width="25"></td>
<td width="66"></td>
<td width="25"></td>
<td width="80"></td>
<td width="25"></td>
<td width="127"></td>
<td width="72"></td>
</tr>
<tr>
<td height="20"></td>
<td valign="top" class="first">
<div align="center"><a href="../index.htm" class="first">home</a></div>
</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="10"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="2"></td>
<td></td>
<td rowspan="3" valign="middle" class="txt"><a href="../sitemap.htm" class="first">site
map </a></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="23"></td>
<td></td>
<td></td>
<td valign="middle"><img src="../images/breaker.gif" width="25" height="10"></td>
<td valign="middle"><a href="../Sales/afterSales.htm" class="first">sales</a></td>
<td valign="middle"><img src="../images/breaker.gif" width="25" height="10" align="middle"></td>
<td valign="middle"><a href="../About/businessHours.htm" class="first">about</a></td>
<td valign="middle"><img src="../images/breaker.gif" width="25" height="10"></td>
<td valign="middle"><a href="../Contacts/feedback.htm" class="first">contacts</a></td>
<td valign="middle"><img src="../images/breaker.gif" width="25" height="10"></td>
<td valign="middle"><a href="../LegalInformation/associates.htm" class="first">legal
informtion</a></td>
<td></td>
</tr>
<tr>
<td height="1"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="11"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
<!-- #EndEditable -->
</body>
</html>


Edited by - les_swift on 30 May 2003 14:16:53

Replies

Replied 30 May 2003 13:55:15
30 May 2003 13:55:15 Lee Diggins replied:
Hi Les

Can you post the code of the results page?

Digga

Sharing Knowledge Saves Valuable Time!!!

Reply to this topic