if-statement

Simple php if query to double check

Is anything wrong with this code? <?php $variable = ; if (isset($variable)) { echo $variable ; echo "also this" ; } else echo "The variable is not set" ; ?> also, the other potential value of the variable is : $variable = <a href="http://www.mysite.com/article"&gt;This Article</a>; To clarify, I have a variable that may hol...

Sql Datareader null values

I am reading from a SQL datareader in C# and passing the values from the columns to a dropdownlist. There are two columns being read. Using IsDbNull, I am able to handle the null values. However, as I have the code written right now, if dr.GetString(0) is null, no values are passed along at all, while as long as only dr.GetString(1) (or ...

If not following correct procedure?

Hi, I'm working on a Content Management System, and so far so good. I'm trying to get the system to work with a maintenance mode system. This is the code in the script to display the maintenance stuff: if ($maintenance['value'] == "1") {?> <div id="content"> <div id="errmsg"> <?php echo $maintenance['notes']; ?> </d...

Trouble with ternary operator/shorthand if

if ((file.Exists) ? lblresults.Text = "the file is there" : lblresults.Text = "the file is not there"); I keep getting the error stating cannot implicitly convert string to bool any help would be great, thanks. ...

MYSQL if statement question...

Is there any way to get the if statement to evaluate a query? SELECT if(5>0,'EQ_Type','*') FROM EQUIPMENT; Resulting in: +-----------------------+ | IF(5>0,'EQ_Type','*') | +-----------------------+ | EQ_Type | | EQ_Type | | EQ_Type | | EQ_Type | | EQ_Type | | EQ_Ty...

C# - If Statement problem?

Not sure exactly what is wrong here. I'm not sure if I am supposed to be using "else if" or what. Here's the code: private void txtMessage_TextChanged(object sender, EventArgs e) { int length = txtMessage.TextLength; int left = 140 - length; charactersleft.Text = left.ToString() + " characters left"; ...

Moscow ML - several if statements in one function.

hi, i'm having some trouble with one part of a function. My function needs an input string of at least 3 characters to avoid error, to do this a want to add one or two "." in the var. Looks something like this: fun function(a, b) = if size(a) < 2 then a ^ " " else if size(a) < 3 then a ^ " " if size(b) < 2 then b ^ " " else if size(b)...

Why won't IE css fix work for internet explorer8? ie statement end if

Hi I've applied an ie fix for my site but it doesn't work for ie8. Do I have to be more specific? <!--[if IE]> <link rel="stylesheet" type="text/css" href="/AEBP_Homepage_12887/css/ie.css" /> <![endif]--> Thanks for your help Regards Judi ...

In a spreadsheet, how do I delete entries from one column IF they appear in another?

Two columns: Column A contains a complete list of available journal titles; Column B contains the ones to which my library already subscribes. Is it possible to delete entries from Column A if they also appear in Column B? In other words, I want to 'dovetail' two columns so that no entry is represented in both columns. Any help will ...

What's the maximum number of operators you that can be used in an if statement?

Hi, i'm using jquery and I'm trying to validate a form. My question is - What is the maximum number of tests can you give in a single if statement. function cc_validate () { if ($("#name").val() == "" || $("#ship_name").val() == "" || $("#address").val() == "" || $("#city").val() == "" || $("#ship_city").val() == "" || $("#state").val()...

Should I use if statement? If yes, what will be good in this PHP case?

When I use function create_category(), it will create a directory with this name such as images/newfolder. Then I have a function edit_category() which checks post('name'). In a controller function edit_category($id=0){ if ($this->input->post('name')){ ... ... I don't want to allow to change the category name. It will create anoth...

Latex - extract substring/ignore characters

I have the following problem. I have defined a macro, \func as follows \newcommand{\func}[1]{% do something with #1 X #1 Y } I now want to define another macro \newcommand{\MyFunc}[1]{ % parse #1 and if it contains "\func{....}", ignore all except this part % otherwise ignore #1 } Can someone tell me how to implement \MyFunc ...

How do I make sure an OptionButton.Value has been chosen

Hi guys, I currently making an Excel VB application. However, I am stuck at the moment. I am trying to make the choice between two OptionButtons compulsory. I tried the code If Me.PWebOption.Value = False & Me.BWebOption = False Then MsgBox "Please choose a type of website" Exit Sub End If But this is not giving me ...

Parsing a nested if statement with javascript

I have some nested if statements with the following syntax: // Comment for condition 1 if(condition1 ,expression1 , // Comment for condition 2 if(condition2 ,expression2 ,else2)) The if statements do not conform to JavaScript syntax. They are written in a language which is "not publicly known, like a mix o...

Trouble with SQL Statment

I have a database for a Train company. I want to combine two queries together so I can use them as one from a Java front end. The first query returns the IDs of trains that are not full. select TrainID from Train where Capacity > 0; Each train has a capacity of 50 and I subtract one each time a seat is booked, so if the capacity...

How can I make if statement using the number of array in PHP?

findParent() function find array. There could be one array or more than one. Now I want to make if statement depends on the number of array. How can I make if statement using the number of array? function findParent($order_id){ ... $Q = $this->db->get('omc_order_item'); if ($Q->num_rows() > 0){ foreach ($Q->re...

conditional skip in python if

hi all, i am trying for something like this def scanthefile(): x = 11 if x > 5 """ i want to come out of if and go to end of scanfile """ print x return info update: if have to check for the content size of a file. and if the content size is larger than a value say 500 , then i should go to the end of t...

SQL Server If statement woes

Hi all, I'm having some trouble with the following sproc Create PROCEDURE GetMatchingUsers @id int = NULL, @lastName varchar(50) = NULL, @firstName varchar(50) = NULL AS BEGIN SET NOCOUNT ON DECLARE @q nvarchar(4000), @paramlist nvarchar(4000) SELECT @q = 'SELECT Id , LastName , FirstName ' SELECT @q = @q + 'FROM User...

How to parse an if statement in bison

I'm using bison to build a compiler for a simple language. Here's part of the grammar: stmt: IF '(' exp ')' stmt{ if(exp) $$=$5; } |PRINT ';' { cout<<"hi"; } ; exp: true|false ; I encountered a problem in parsing this if statement: Say I have this code: if(false) print; "hi" will be printed anywa...

jQuery condition for animation

Hey all, am brand new to javascript and jQuery so this question might seem dumb but i couldnt find any exemple or doc on it. I got this function for a little color animation roll-over and roll-out which works fine: $(".box_nav").hover(function(){ jQuery(this).stop(true, false); $(this).animate({ backgroundColor:...