navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Hyperlinking FP wit an If Else

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Hyperlinking FP wit an If Else
Page: [1]
 
WIryeman

 

Posts: 14
Joined: 2/27/2003
Status: offline

 
Hyperlinking FP wit an If Else - 5/5/2003 22:59:35   
Help,

I can' t get this work, becides the obvious, its wrong , I am stumped. Any Ideas?

<%If FP_FieldVal(fp_rs," M1" )>= 0 Then
response.write " <a href=macklake.asp?M1=FP_FieldURL(fp_rs," M1" ) FP_FieldVal(fp_rs," M1" )</a>"
Else
response.write" "
End If
%>

This is the error repsonse
Microsoft VBScript compilation error ' 800a0401'

Expected end of statement

/Lakes/lakedetail.asp, line 299

response.write " <a href=macklake.asp?M1=FP_FieldURL(fp_rs," M1" ) FP_FieldVal(fp_rs," M1" )</a>"
-----------------------------------------------------------^

Thanks
Ryeman


_____________________________

May Your Boots Dry Quickly
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Hyperlinking FP wit an If Else - 5/5/2003 23:08:12   
<%If FP_FieldVal(fp_rs," M1" )>= 0 Then 
response.write " <a href=" " macklake.asp?M1=" &FP_FieldURL(fp_rs," M1" )&" " " >" & FP_FieldVal(fp_rs," M1" )&" </a>"  
Else 
response.write " "  
End If 
%>


Assuming all M1 values are numeric, and you wish to perform a comparison, youll have to use cInt(FP_FieldVal(fp_rs," M1" ))

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to WIryeman)
WIryeman

 

Posts: 14
Joined: 2/27/2003
Status: offline

 
RE: Hyperlinking FP wit an If Else - 5/5/2003 23:19:27   
That did it Thanks Spooky

(in reply to WIryeman)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Hyperlinking FP wit an If Else - 5/5/2003 23:42:35   
A slightly more efficient way is to do it like so :

<%
DIM M1
M1=FP_FieldVal(fp_rs," M1" )

If M1>= 0 Then
   response.write " <a href=" " macklake.asp?M1=" &M1&" " " >" &M1&" </a>"    
Else   
response.write " "    
End If   
%>


_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to WIryeman)
WIryeman

 

Posts: 14
Joined: 2/27/2003
Status: offline

 
RE: Hyperlinking FP wit an If Else - 5/6/2003 21:29:07   
Spooky,

After slight modification I got the first one to work, the second one kept bommbing off. Something it didn' t like in the " Else"

When I try to run the code 2 or 3 times like below I keeping getting error in the second exectution:

" Microsoft VBScript runtime error ' 800a000d'

Type mismatch: ' [string: "  " ]'

/Lakes/lakedetail.asp, line 301

Here is my code...

<td width=" 27" height=" 27" >
<%If FP_FieldVal(fp_rs," M1" )>= 1 Then
response.write " <a href=" " macklake.asp?M1=" &FP_FieldURL(fp_rs," M1" )&" " " >" & FP_FieldVal(fp_rs," M1" )&" </a>"
Else response.write " "
End If %></td>
<td width=" 27" height=" 27" >
<%If FP_FieldVal(fp_rs," M2" )>= 1 Then
response.write " <a href=" " macklake.asp?M2=" &FP_FieldURL(fp_rs," M2" )&" " " >" & FP_FieldVal(fp_rs," M2" )&" </a>"
Else response.write " "
End If %></td>
<td width=" 27" height=" 27" >
<%If FP_FieldVal(fp_rs," M3" )>= 1 Then
response.write " <a href=" " macklake.asp?M3=" &FP_FieldURL(fp_rs," M3" )&" " " >" & FP_FieldVal(fp_rs," M3" )&" </a>"
Else response.write " "
End If %></td>

Thanks
Ryeman

(in reply to WIryeman)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Hyperlinking FP wit an If Else - 5/6/2003 21:54:46   
Thats the numeric comparison I was talking about.

You cant do >= when the result is a string.
You can only do
If this<>" that" OR This=" that"

For numeric values, you can use the normal operators
If thisNumber <> 0 or thisNumber >=0



_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to WIryeman)
WIryeman

 

Posts: 14
Joined: 2/27/2003
Status: offline

 
RE: Hyperlinking FP wit an If Else - 5/7/2003 12:23:38   
Spooky,
[:j] Sorry I read your numeric statement as refering to the code above it...

So something like this should work?

<% DIM M1
M1=CInt(FP_FieldVal(fp_rs," M1" ))
If M1>= 1Then
response.write " <a href=" " macklake.asp?M1=" &M1&" " " >" &M1&" </a>"
Else
response.write " "
End If
%>

I read some where that I can drop the " Else and " End If" because I am only testing if is true and doing something only if it is true.

So this should work too?

<% DIM M1
M1=CInt(FP_FieldVal(fp_rs," M1" ))
If M1>= 1 Then
response.write " <a href=" " macklake.asp?M1=" &M1&" " " >" &M1&" </a>"
%>

I am away from my home computer. Rethorical? Unless you see a flaw.


< Message edited by WIryeman -- 5/7/2003 12:25 PM >


_____________________________

May Your Boots Dry Quickly

(in reply to WIryeman)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Hyperlinking FP wit an If Else
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts