Conditional Sql Statements

I have a shopping cart that I want to load items in that come from a huge scrolling form. In other words, when someone clicks on a category in our site, it scrolls out all the items in that category, maybe 30 or more. I have text boxes next to each item so somone can enter a number, then press submit form button at the bottom of the form, and
send those slections to the shopping cart.

The problem is, many of the text boxes are empty, yet they are still being sent to the shopping cart as a quatity of 0. Is there a way for sql to ignore a value if the variable is zero, or only get the sql statement to run if a variable is > 0?

View Replies


ADVERTISEMENT

Conditional IF

I have a form with a list/menu where you select the year you were born. Now, when I submit this form, it creates a new register in my database etc.

How can I use a conditional to redirect a person that for example was born in 1987 or less?

if request.form("year")="1987" then%> is this the correct way to start?

View Replies View Related

URL Conditional

I have a ton of dynamic pages that I need an asp conditional to run on.I know the urls of all the pages and I want to know if there is an easy way to write a conditional statement that if they are on a specific page that it outputs something depending on the url they are on. Is there an easy way to do this?

View Replies View Related

Conditional

I have the following simple conditional on my page,

If EmpIDError <> 1 Then
'Show Input items
End If

Now I need to add another conditional to this,

If PosIDError <> 1 Then
'Show input items
End If

So I made it like this,

If EmpIDError <> 1 OR PosIDError <> 1 Then

But the problem is that if PosIDError = 1, then it still shows the input
items. But if I take the EmpIDError <> 1 out then it works with no
problems. Why would this be like this?

View Replies View Related

Conditional Statement

I've got the following VB in an ASP page and can't see why it won't work

<% if Request.QueryString(Failed=="N")%> The Failed variable is N <% else
%>The failed variable is not N<% end if %>

I'm calling the page as thepage.asp?Failed=N

View Replies View Related

Conditional Inculde

I have written a small library for ASP, and I tried to keep it in a modular fashion, splitting my library in some files.

Then I have a file named "framework.asp" that include all the other files.

The problem is that I can't reuse code internally to my library because if for example:

framwork.asp include:
- utils.asp
-html.asp

Then html.asp include:
-utils.asp

If the programmer include framework.asp would have 2 times the same file utils.asp in his ASP page! Code:

View Replies View Related

Conditional Statement

I have a code for executing a stored procedure and returning a recordset wrapped in an IF statement. If the statement is true the code executes. If the statement is false the code is skipped.

On the page, I want to display a message if the Recordset returned from the stored procedure is empty.

<% If rs.BOF or rs.EOF Then %>

Message

<% End If %>

Running the above code will return an error message if the recordset object doesn't exist...i.e. if the stored procedure hasn't executed and returned the recordset object.

How can I write the code to include that condition?

View Replies View Related

Conditional Includes

Will this work in asp 3.0:

If True Then
<!-- #include file="test1.asp" -->
Else
<!-- #include file="test2.asp" -->
End If

View Replies View Related

Conditional Formatting

i have an simple invoice sheet and in "total" coloumn i need to put a formula like IF < 8.50 THEN VALUE =8.50.it is something like we dont do delivery less then 8.50 so if the TOTAL is less than 8.50 then it should turn in to 8.50 automatically.

View Replies View Related

Conditional Compilation

One of my asp pages can be loaded in two ways - it may be submitted to itself (and therefore contains user data) or it can be loaded by clicking on a link on my menu, and consequently all fields are empty.

If the fields contain values (ie. the submit button was pressed), i want to load data from my database into an array, but if it is accessed via a link, i don't want this data to be loaded. So essentially, i want to know if there is some form of conditional compilation or something in asp (i know it technically shouldn't be called that, but i'm coming from a c++ background, so...) similar to the #if and #elif type directives in C

I can't place the code in a subprogram and selectively call it, because I want the arrays to be global so all my client-side scripts can access the data I'm using VBScript for the asp scripting.

View Replies View Related

Nested If Else Conditional Statament

I am not too sure wats wrong w the if-else statement below!

<%if(grp==grp2)%>
{
<%if (start==req || end==req)%>
{
<%=grp%>
<%=start%>
<%=end%>
}
<%else%>
{
<%="There is no such record found"%>
}
}
<%else%>
{
<%="There is no such record found!"%>
}
<%endif%>

Error: 'else' without 'if'.
else
^

View Replies View Related

Conditional Display Of Data From DB

displays content IF several conditions exist or display's nothing if it doesn't?

Basically, in english this is what I'm trying to do:

IF a record exists

WHERE session(userID) = idByUserID in 'notes'
AND
WHERE userID = idAboutUserID in 'notes'

THEN

display from the record fieldnames 'LastUpdate' and 'note'

ELSE
don't display anything

View Replies View Related

Conditional Page Re-direct

I have a 'primary' intranet website and a 'secondary' backup of this site as
well. I would like to programmatically have the effect that if the
primary site is (page not found 404) not available, for it to access the
secondary site or at least be able to add a message with (or instead of) the
404 error dialog that the primary site is down and give the user a link to
the alternative (secondary) site.

View Replies View Related

Evaluating A QueryString In A Conditional

Ok I know this is simple but I cannot get it to work.
on the URL I have:

.../default.asp?strCode=xxx

I then have:

If Request.QueryString("strCode") = "xxx" Then
Response.Write "code is XXX"
End If

So for some reason it is not evaluating the queryString and does not enter into the conditional. Why?

View Replies View Related

Conditional Routine And Date

I'm trying to not show some data dependant on date but it never works right.

<% If Request.QueryString("EventDate") > DateAdd("d",6,Date()) Then %>

I have used similar routines before and it worked fine but this time i'm using a QueryString instead of a database field.

View Replies View Related

Advanced Conditional Statement

URLURLI need help writiing an advanced conditional statement.I want to display an image if two recordset values = 1 or other various number combinations.

This statement works with one, how could I edit this statement to include two recordsets values? Say I want to add another feild say "recent" to this statement and it has a value of 2

Code:

<% if Recordset1.Fields.Item("progress").Value = 1 then ' Adv Conditional Region %>
<% end if ' Recordset1.Fields.Item("progress").Value = 1 %>

View Replies View Related

Conditional Statement On DB Currency Field

Given a value in a database (Access) of type Currency how do I write a conditional statement such as the following:

if rs("price") > "$1,000,000" Then
Response.Write " Luxury Home"
End If

When I try this it writes out Luxury Home for every record, regardless of the value in Price.

View Replies View Related

Dreamweaver Conditional Statement Code

I'm just trying to figure out what the colon : does in this code:

<%If (Not isNull(COLOR)) Then If (COLOR = "Blue") Then Response.Write("SELECTED") : Response.Write("")

I thought it may be the ASP version of the Ternary operator, but it doesn't have the same effect. Is it just another way to concatenate? or a reverse concatenate?
or maybe a addition of an empty string to make sure that the output from the response.write statement is a string and not a number?

If the second response statement has a value then it prints it e.g. Code:

View Replies View Related

Conditional Color Formatting Of Field In A Table

This is probably a simple question, but how does one format a table such that if a field is a certain value, then it will have a specific color.

For example, in the code below, if the specific field named "Year" is '2004' then I want it to appear in red, otherwise it should appear in black. Code:

View Replies View Related

Asp If Statements

I need some help with some if statements in an asp page I got. My sql statement is:

sql = "select * from courseDesc"

I want to logically diplay all the information on the page. So I inserted this if statement to choose the information I want to dispaly:

<% if rs("courseName") = "whatIsCist" then
response.write(rs("description"))
end if %>

Other courseName titles I need to display the information for further down the page, include: wdt, lan, wan, programming, admissionReq1,2,&3. Does anyone see where my problem is?

View Replies View Related

IF Statements

I'm having problems getting some ASP code to work with a form I'm using. I'm using the script with a multiple page form and want to print a javascript onsubmit value for just one of the forms. I'm getting errors because of the multiple IF statements and I'm not sure how to do this and have the "s show up properly in the output. Can someone tell me how to do this properly?

Code:
<% If step < 5 Then Response.Write " <form action="/script.asp" method="post" name="theForm" id="theForm" & If step < 1 Then Response.Write " onsubmit=""" & "return checkForm(this);" & End If %> & ">" & End If %>
Here is how I want it to output:

<form action="/script.asp" method="post" name="theForm" id="theForm" onsubmit="return checkForm(this);">

View Replies View Related

Use Or And Statements

is there a way to use "or, and" statements in asp,
what i want to do it do 2 seperate checks on the database and if one is true or the other one is true then display some text is this possible and also the same check again on the database but the first statement and the second statement has to be true then display some text is this possible, if yes how would i do it?

View Replies View Related

If Then Statements

I have a field on an asp form called hotelYesNo (YesNo value-pulldown) and a field called roomMate.

I want to do an If Then statement likeso: If hotelYesNo = Yes Then roomMate is required, but if hotelYesNo = No Then roomMate is not required.

I don't know how to get this accomplished in the asp code.

I know how to do this in Microsoft Access but not on a webpage.

How would this be done?

View Replies View Related

If Then Statements

I want to run a query and need to use If then statements such as: If this is output, then run this query. Is there a way to do this?

View Replies View Related

If Statements

I didn't really get a direct answer in the .net forum so I guess I'll just post it here where it should be anyway. Instead of .net I'm just going to probaly stick with 3.0. I want to have several different templates for users to browse a site in.

Since I can't use include files in ASP is there a way I can ONLY load coding in an if statement as it applys to that certain user? I want to enclose multiple images and coding into one file but only load the ONE image/code that pertains to the user. Is this possible using if statements?

View Replies View Related

IF Statements

i am trying to find out if three feilds in a record match, if so send it to another page. basically see code.

Quote: rs.Open "Rental", cs, adOpenDynamic
Do Until rs.EOF
If rs.Fields("MemberID").Value=person And rs.Fields("DVDID").Value=dvd And rs.Fields("Current").Value=true then
Response.redirect "copy.asp?memberid=" & person
End If
rs.MoveNext
Loop

this does not bring up a problem just does not do it any ideas on if staemenst etc in asp thingy.

View Replies View Related

ASP And SQL Statements

I have a (hopefully) simple question that has been giving me some problems. I'm trying to use a simple Select statement to access some data in an access database. In access, the sql statement is as follows:

SELECT TPL_Checklist_Master.[1] From TPL_Checklist_Master

However, when I try to do this on an ASP Page, it always causes an error. I'm assuming this is because of the [] around the field name 1. (I would change the field names, but I don't have control over that).

I know when trying to use a * in the statement Where field LIKE 'A*' I needed to replace the * with a %. I was wondering if something similar had to be done in this case.
I hope my description is clear enought to follow.

View Replies View Related

Asp If Statements

We have currently launched a website in ASP and now want to add some tracking functions.
We have banner ads and emails that we are launching.I would like to create code that will allow me to change the an image and a text link based on where the user is linking in from.

I.e If they clicked on banner xy - then the index page the images would be xy and the text box in another page would be xy. if they clicked on banner zz - then the index page the images would be zz and the text box in another page would be zz.

View Replies View Related

Include Statements

I have been avoiding this issue but it keeps popping up and I cannot figure out a solution. Include statements pathed two or more folders deep they break.

This works:
<!--#include file="../includes/mo_security.asp" -->

This does not work:
<!--#include file="../../includes/mo_security.asp" -->

So basically my site files are limited to one folder deep.
Ex: ROOT/parentFolder/files.htm
One I move another level down the includes do not work anymore:
Ex: ROOT/parentFolder/childFolder/files.htm
I am on a Windows IIS server. Is there any solution to this or is it just a limitation of the include statement?

View Replies View Related

Converting Sql Statements

I have a project to do that requires that I use mysql as the database. I have only used MS Access. The sql will be simple searches.
Is there a drastic difference, or just different punctuation?
Can I find a copy of mysql on the web? If so, is there any advice on installing?

View Replies View Related

VBScript If Statements

Is it possible to wirte a VBScript If statment that outputs different HTML? IE: If **** = True then do this HTML else do this HTML?
How do you do something like that?

View Replies View Related

LIKE Operator For IF Statements?

Basicly I pull the whole column contents and what to test to see if the username is that list. How can I do this in an if statement. I know how to do this kind of thing in SQL (LIKE operator) but I need to test agains two recordsets. Code:

View Replies View Related

ASP With SQL Insert Statements

Question 1: How can have th asp script automatically convert the date generated by the system to a format which is acceptable by Sybase SQL (yyyymmdd)

Question 2: If the user were to insert a a string containing " ' ", how can I convert it into a special character so that it won't be treated by Sybase SQL as the start/end of a variable?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved