if-statement

IF statement to combine 7 columns

I have 7 columns that have a yes or no in them (N2-T2). I need an equation that will place a 1 in "AI2" if there is a yes in any of the N-T cells. In my previous work with Excel I have only used the colon in an equation if I am adding the cells. Is this correct or does it have more use? I tried the equation below and I get an error; #Va...

Allowing decimal in numbers only field with JavaScript

Hi all, I have a function which I use to limit form inputs to numbers only, or number and decimals depending on the field. Allowing decimals and numbers is easy enough, but I am trying to take it a step further and allow only one decimal, while also making sure that decimal is not the first character in the field. I have successfully a...

Lots of 'If statement', or a redundant mysql query?

Hey all, $url = mysql_real_escape_string($_POST['url']); $shoutcast_url = mysql_real_escape_string($_POST['shoutcast_url']); $site_name = mysql_real_escape_string($_POST['site_name']); $site_subtitle = mysql_real_escape_string($_POST['site_subtitle']); $email_suffix = mysql_real_escape_string($_POST['email_suffix']); $logo_name = mysql_...

Will this if statment cause bad things to happen?

int expenseCode; if (int.TryParse(sourceRecord.ExpenseCode, out expenseCode) && _ExpenseCodeLookup.ContainsKey(expenseCode)) { destRow.PROFIT_CENTER_NAME = _ExpenseCodeLookup[expenseCode]; } else destRow.PROFIT_CENTER_NAME = "Unknown"; The thing I am conerned about is will the first expression always be run (setting expenseC...

jQuery if any of a certain class is hidden perform a task, else, perform another task

Is there a way to test if a certain element (.container) is hidden, in a whole document? Such as (which doesn't work properly): $(".showall").click( function () { if ($(".container").is("hidden")) {perform a task} else {return false;} }); ...

Need help creating an IF statement with 3 possible answers, each based on a different range of data

I have 3 ranges of numbers and the answer depends on the range. 75-79=0.255 80-84=0.327 85+ =0.559 I tried to create an equation that accounts for the ranges, however excel states that I have entered in too many arguments for this function. Below is the equation that I entered that is not working. (X2 contains the number) =IF(X2=7...

Managing conditional redirect_to in Rails

I have multiple user types in a system that shows each user different views and templates of the stored information, often based on whether they are logged in and what current_user.user_type is. As a result, I have lots of this: #controller @project = Project.find(params[:id]) if current_user.user_type == "Company" redirect_to :contro...

jQuery,trying to validate one field or the other based upon what is chosen

Im trying to set up a form where a user has to pick an option from a select or enter a value in an input. One must be required but not both. I was attempting to write an if else statement if the state is selected then remove the class on province, if province is filled then remove class on state $("#state").bind('change' , function() {...

Problem in a php if condition

I have a small problem. I access the site thru foro.php?id=74&mode=add or foro.php?id=74&mode=edit it works fine.. But when I add a colon, semicolon (; or :) to foro.php?id=74&mode=add it goes to the edit option foro.php?id=74&mode=add; foro.php?id=74&mode=add: foro.php?id=74&mode=add’ Below is my code <?php $numb=mysql_real_escape_...

conditionally import framework

Hi guys, well to begin with I'm sure this is a simple question. I am developing an iPhone app with the iAd Framework, which only runs for iOS 4.0 or higher. Still, I wanna choose a iPhone OS 3.0 deployment target, which causes everything to crash. How do I conditionally include the iAd framework? ...I mean, it would be something like...

Simplifying multiple echos

I have a full list of timezones in a select menu like so: <option value="Pacific/Kosrae"> Pacific/Kosrae( +11:00 GMT ) </option> <option value="Pacific/Kwajalein"> Pacific/Kwajalein( +12:00 GMT ) </option> <option value="Pacific/Majuro"> Pacific/Majuro( +12:00 GMT ) </option> <option value="Pacific/Marquesas"> Pacific/Marquesas( -...

Use IF in a mySQL query

Hi, I'm trying to make a SELECT where I need to select a specified table by a column wich define the type of subject: table_buildings id name location source_type source_id 1 NY Appartament New York 0 NULL 2 Guggenheim Museum Manhattan 1 27 3 M...

what is the syntax for "or" inside an if statement?

I could probably use multiple else if statements, but is there a simpler and cleaner way to do an if (condition or othercondition..) in objective-c? ...

Javacript Condition Matching but Not Returning True?

Please have a look at the following: jQuery(document).ready(function() { var full_url = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname; var part_url = window.location.protocol + "//" + window.location.host + "/domain/shop/"; part_url = part_url + "cat1/"; if (full_url ==...

Search mySQL with PHP, using a WHERE wildcard or an IF statement?

I'm letting users search my database for data by city. My query looks like: $results = mysql_query("SELECT * FROM mydb WHERE City='".$city."' LIMIT 10"); I want a user to be able to search 'all cities', so I'd like to either remove the WHERE statement if $city=='all cities'; or use a wildcard for the WHERE statement that matches all ci...

for 1 second: objective c coding help

Is it possible to do something like this? if (myVariable == 100 for more than 1 second) { } So if myVariable equals 100 for more than 1 second do something. Thanks! Elijah ...

Timer not firing in an event handler containing two adjacent 'if' blocks!

when i'am calling timer1.Start() func in an event handler that contains two adjacent if blocks, its tick events doesn't fire and the code following it also doesnt get executed. on the othr hand, using an if-else pair instead solves the problem. why it can be so?? ...

perl if-then-else logic and how to handle no data if regex doesn't match

So far, I have some working code that goes into a list of servers and does some regex to grab data from a log file. What I want to do is to pring out a status of "NOTHING TO REPORT FOR THIS SERVER" if there is NO data to capture from the regex on a particular server. Right now, it goes through each server and if data matches the regex,...

PHP - if condition inside string

An easy question to ask, hope not to stupid. $var=0; $condition="$var!=0"; if($condition) { # do something # } else { # do something else # } Obviously the code up there doesn't work as intended. Is there a nice way to obtain an if-condition from a string? Or do I have to parse the string in some disturbing way? EDIT I didn't...

Single If Statement needs Begin & End in code block

I ran into this a bit ago and was wondering why the "Begin" & "End" is need to result in correct values. the if statement(s) is a singleton and does not require the "Begin" & "End" where multiple statements in the if would require it and if omitted would generate an execution error when trying to create/alter the procedure. Any ideas...