Jump to content

Search the Community

Showing results for tags 'if'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 17 results

  1. I am having a small issue translating my excel if statement into a CASE clause. Bellow I have posted my current SQL statement and the IF statement i am trying to fit in. I At the moment i have wrote it into the WHERE Clause but when i run it only returns the data which applies to the product description. Because of the way my where clause is set up it mean i only get half results where as i want it to show if column a does not match criteria then look for certain items in column b IF Statement is =IF(PD="AC","S",IF(PD="CS","S",IF(PD="CA","S",IF(**PT="SS","S"," ")**))) Current SQL SELECT AEOrdersReceivedCurrentQuarter.`Order Company` , AEOrdersReceivedCurrentQuarter.`Sop Order Number` , AEOrdersReceivedCurrentQuarter.`Order Date` , AEOrdersReceivedCurrentQuarter.`Order Method` , AEOrdersReceivedCurrentQuarter.`Payment Method` , AEOrdersReceivedCurrentQuarter.`Product Type` , AEOrdersReceivedCurrentQuarter.`Product Sub Type` , AEOrdersReceivedCurrentQuarter.`Product Description` , AEOrdersReceivedCurrentQuarter.`Quantity Ordered` , AEOrdersReceivedCurrentQuarter.`Product Item Value` , AEOrdersReceivedCurrentQuarter.`Order Count` , AEOrdersReceivedCurrentQuarter.`Order Item Narrative` , AEOrdersReceivedCurrentQuarter.`Product Group` , AEOrdersReceivedCurrentQuarter.`Product Category` FROM AEOrdersReceivedCurrentQuarter.csv AEOrdersReceivedCurrentQuarter WHERE (AEOrdersReceivedCurrentQuarter.`Product Type` = 'Studio Services' OR AEOrdersReceivedCurrentQuarter.`Product Description` IN ('Artwork Charge','Creative Services','Creative Agency','Studio Services') )
  2. The comment basically has my issue, but I'm basically trying to fix my second var prompt so it will actually run and I can't figure it out. If anyone can help I would greatly appreciate it. Line comment: var one above this comment isn't working, how do I fix it? I also need it to continue to the next else if statement once something is entered. I'm thinking of making it so that if it changes var input to 2 once it's entered then 3, will that work? <!DOCTYPE html> <html> <head> <title>Project 1 – Michael Fiorello</title> <script> do{ var input = prompt ("Please enter 1, 2, 3, or exit.");{ if (input == "1") {for var one = prompt ("Please enter a string"); //var one above this comment isn't working, how do I fix it? I also need it to continue to the next else if statement once something is entered. I'm thinking of making it so that if it changes var input to 2 once it's entered then 3, will that work? if (one != null) else console.warn("You need to enter something") }in(one !="") //need the above "in" to cause it to loop this section until something is entered for var one else if (input == "2") { alert ("COOL!") } else if (input == "3") { alert ("AWESOME!") } else if (input.toLowerCase() == "exit") { alert ("Okay") } else { alert ("Nope") console.warn("You need to enter something"); } } }while(input != "exit"); </script> </head> <body> </body> </html>
  3. So, I have a code that asks a question, and if the answer in correct, it says correct in the div. If incorrect, it says incorrect. For some reason it always says incorrect even if my answer is correct. Please help, is there anything wrong with this code? //*If players 1 turn if (player == "1"){ //*Asks question var trivia = prompt(questions_obj.question); //*If answer is corerct do stuff if (trivia === questions_obj.answer){ document.getElementById('correctincorrect').innerHTML = "Correct"; $('#character1').animate({left: "+=75px"}, 500, function(){ //*If player gets to finish they win if (player1total == "8"){ var winner1 = alert("Player 1 is the winner!"); $('#character1').remove(); $('#character2').remove(); $('#character3').remove(); $('#player1score').remove(); $('#player2score').remove(); $('#player3score').remove(); $('#player1header').remove(); $('#player2header').remove(); $('#player3header').remove(); $('#player1board').remove(); $('#player2board').remove(); $('#player3board').remove(); } }); //*Adds up players score player1total = player1total + 1; document.getElementById("player1score").innerHTML = player1total; } if (trivia === questions_obj.answer2){ document.getElementById('correctincorrect').innerHTML = "Correct"; $('#character1').animate({left: "+=75px"}, 500, function(){ //*If player gets to finish they win if (player1total == "8"){ document.getElementById('correctincorrect').innerHTML = "Player 1 is the winner!"; $('#character1').remove(); $('#character2').remove(); $('#character3').remove(); $('#player1score').remove(); $('#player2score').remove(); $('#player3score').remove(); $('#player1header').remove(); $('#player2header').remove(); $('#player3header').remove(); $('#player1board').remove(); $('#player2board').remove(); $('#player3board').remove(); } }); //*Adds up players score player1total = player1total + 1; document.getElementById("player1score").innerHTML = player1total; } if (trivia != questions_obj.answer || trivia != questions_obj.answer2){ document.getElementById('correctincorrect').innerHTML = "Incorrect"; }}
  4. mlitch

    if condition

    Can anyone tell me why this Javascript isn't working? (The following is the PHP code:) if ($quantity>$inventory) { echo '<script language="javascript"> var i = confirm("There are '; echo number_format($inventory); echo ' copies in inventory in '; echo $warehouse_name; echo '.nnThis order is for '; echo number_format($quantity); echo ' copies.nnThat is '; echo number_format($difference); echo ' more than are available.nnClick OK to create a backorder for this itemnor Cancel to abort."); if (!i) window.close();'; echo '</script>'; } The idea is simple: A confirm box opens with a message. If the user clicks OK, the PHP code continues. If the user clicks Cancel, the window should close without executing any more PHP code. Right now, it doesn't matter which button you click: the PHP code just continues regardless. How can I fix this?
  5. Hello i try make it like: <html><head> <script type="text/javascript"> function Code() { A=["T1","T2","T3",4,2,1]; var B1=A;var B2=A;var B3=A; if (A[0]=="T2") {B1[3]=5;} if (A[1]=="T2") {B2[3]=5;} if (A[2]=="T2") {B3[3]=5;} document.getElementById('W1').innerHTML="B1:"+B1[3] document.getElementById('W2').innerHTML="B2:"+B2[3]; document.getElementById('W3').innerHTML="B3:"+B3[3]; } </script></head><body> <input type="button" value="Code it!" onClick="Code()"><br><br><br> <div id="W1"></div> <div id="W2"></div> <div id="W3"></div> </body> when i press button then i got 5 on all B1, B2 and B3. but it should be only B2 have 5 while other got 4. Why it going wrong?
  6. Hello, I am still rather new to JavaScript. I am working on making a study tool for school. Below I have a sample of my code. I would like for a case to included in the array WordList only if a condition is true. I have check-boxes for each case. What I have currently is a poor workaround where if for example case 1's box is not checked it will shuffle again and then run the function again. Instead, I would like to make it so that if case 1's box is not checked it won't be included in the array at all, if that's possible. I'm sorry I can't explain this very well. Thanks in advance for any input. Array.prototype.randomize = function(){ var i = this.length, j, temp; while ( --i ) { j = Math.floor( Math.random() * (i - 1) ); temp = this[i]; this[i] = this[j]; this[j] = temp; }}var WordList = [0,1];WordList.randomize();function Word() {var WordL = WordList [0];switch (WordL) { case 0: if(document.getElementById('micro').checked) { WordL = MicroList.randomize(); Micro();} else {WordList.randomize(); Word();} break; case 1: if(document.getElementById('immuno').checked) { WordL = ImmunoList.randomize(); Immuno();} else {WordList.randomize(); Word();}}}
  7. I am fairly new to PHP and I was tasked with migrading an app that runs on php 4+ enviroment into a 5.4 enviroment and I am getting warnings becasue its very old code, but I also would lie to know if there is a better way of writing the fallowing script of php code. It checks weather a member has attended a course and if so it charges a price if not its a different price and so on. Any help would be very appriciated. <?phpif ($semattend == 'MEMBER-ATTENDED') {$total = "<tr> <td height="30" align="right"><p><font color="#FF9900">*</font><font size="2">Total: </font></p></td> <td height="30" colspan="3" align="left"><font size="2"><input type="hidden" id = "amount" value="1299" name="amount" size="28">$1,299</font></td> </tr> <tr> <td colspan="3" align="left"><p>Search results indicate that you belong to a member instituion and have completed the Essentials of SEM course</p></td> </tr> <input type="hidden" id = "semstatus" value="MEMBER-ATTENDED" name=semstatus"> <input type="hidden" id = "attended" value="Attended Course" name="attended"> <input type="hidden" id = "member" value="Member" name="member">";} elseif ($semattend == 'MEMBER-NOTATTENDED') {$total = "<tr> <td height="30" align="right"><p><font color="#FF9900">*</font><font size="2">Total: </font></p></td> <td height="30" colspan="3" align="left"><font size="2"><input type="hidden" id = "amount" value="1799" name="amount" size="28">$1,799</font></td> </tr> <tr> <td colspan="3" align="left"><p>Search results indicate that you belong to a member instituion and have not completed the Essentials of SEM course</p></td> </tr> <input type="hidden" id = "semstatus" value="MEMBER-NOTATTENDED" name=semstatus"> <input type="hidden" id = "attended" value="Not Attended Course" name="attended"> <input type="hidden" id = "member" value="Member" name="member">"; } elseif ($semattend == 'NONMEMBER-ATTENDED') {$total = "<tr> <td height="30" align="right"><p><font color="#FF9900">*</font><font size="2">Total: </font></p></td> <td height="30" colspan="3" align="left"><font size="2"><input type="hidden" id = "amount" value="1599" name="amount" size="28">$1,599</font></td> </tr> <tr> <td colspan="3" align="left"><p>Search results indicate that you do not belong to a member instituion and have completed the Essentials of SEM course</p></td> </tr> <input type="hidden" id = "semstatus" value="NONMEMBER-ATTENDED" name=semstatus"> <input type="hidden" id = "attended" value="Attended Course" name="attended"> <input type="hidden" id = "member" value="Non Member" name="member">"; } elseif ($semattend == 'NONMEMBER-NOTATTENDED') {$total = "<tr> <td height="30" align="right"><p><font color="#FF9900">*</font><font size="2">Total: </font></p></td> <td height="30" colspan="3" align="left"><font size="2"><input type="hidden" id = "amount" value="2099" name="amount" size="28">$2,099</font></td> </tr> <tr> <td colspan="3" align="left"><p>Search results indicate that you do not belong to a member instituion and have not completed the Essentials of SEM course</p></td> </tr> <input type="hidden" id = "semstatus" value="NONMEMBER-NOTATTENDED" name=semstatus"> <input type="hidden" id = "attended" value="Not Attended Course" name="attended"> <input type="hidden" id = "member" value="Non Member" name="member">"; }echo $total;?>
  8. i was trying to apply condition to some query to execute.. if ($col != 'name' or 'item') {// query would execute here} but it is not doing as expected. i want both conditions (or may be more) to execute the query but it is working only in first condition (i.e. $col != 'name') but not working for second (i.e. $col != 'item').. please guide me through
  9. paulonline2501

    php if else

    hi everyone, I'm having trouble with a PHP if statement. I'm getting a value back from a database. the values stored in the DB aren't exactly what I want to display so im going to do a inline conversion on them. I want to say for example: if the region = 'central' then display 'central Scotland'. ive added my conversion but the value that is stored in the DB is showing rather than the converted value. can anyone spot what is wrong? UPDATE: OK, so it works for all of these apart from the "North & Islands" one. all othere convert, but this one doesn't. it doesn't change to "North, Highlands & Islands" it just stays as "North & Islands". the others change. the code is below: <h3><strong>Region:</strong> <?php if($db_oregion=="Central"){echo("Central Scotland");} elseif($db_oregion=="East"){echo("East Anglia");} elseif($db_oregion=="Mid"){echo("Mid & West Wales");} elseif($db_oregion=="North"){echo("North Wales");} elseif($db_oregion=="North & Islands"){echo("North, Highlands & Islands");} elseif($db_oregion=="South"){echo("South Wales");} else{echo($db_oregion);} ?> </h3>
  10. i'm trying to get make query relating to the date selection. and if no date is selected, i want to make default query without date selection. for this i tried this ---- // above this there is a form with two input fields for from date and to date selection with a submit buttom. action is $_SERVER['PHP_SELF']if (!isset($_POST['sort'])) { // 'sort' is the submit button name$query = "SELECT * FROM tran WHERE ssn!=0 ORDER BY date";} else { $fdate == $_POST['fdate']; // from date $tdate == $_POST['tdate']; // to date$query = "SELECT * FROM tran WHERE ssn!=0 AND date BETWEEN '$fdate' AND '$tdate' ORDER BY date";} but this is not working... any suggestion!!!?????
  11. I have this issue with a function where I want to execute 4 different actions inside an if statement. My code looks like this: function deltagare(){var myTextField1 = document.getElementById('namn');var myTextField2 = document.getElementById('epost'); if(myTextField1.value != "" && myTextField2.value != "")document.getElementById("deltagare-list").value+=myTextField1.value+" "+"("+myTextField2.value+")"+"\n",document.getElementById("deltagare-emaillist").value+=myTextField2.value+",",document.getElementById('namn').value="",document.getElementById('epost').value=""; elsealert("Skriv in både namn och epost!"); } In this way only the first action gets executed. How can I add the other ones properly?
  12. Hi I have simply select and works great: select 'CARAT Issue Open' issue_comment, i.issue_id, i.issue_status, i.issue_title, i.ISSUE_summary ,i.issue_description, i.severity,gcrs.Area_name, gcrs.sector_name,substr(gcrs.stream_name,1,case when instr(gcrs.stream_name,' (')=0 then 100 else instr(gcrs.stream_name,' (')-1 end) ISSUE_DIVISION,case when gcrs.STREAM_NAME like 'NON-GT%' THEN 'NON-GT' ELSE gcrs.STREAM_NAME END as ISSUE_DIVISION_2from table(f_carat_issues_as_of('31/MAR/2013')) iinner join v_gcrs_with_stream gcrs on i.segment_id = gcrs.segment_idwhere UPPER(ISSUE_STATUS) like '%OPEN%' Now I want to callte two columns: ISSUE_DIVISION and ISSUE_DIVISION_2 if they are equal in new columns should be value 1 if are not equal should be 0, how can I do it ?
  13. Hello, I have a problem involving Phpmailer and a While loop. Actually I have always had problems to sending emails this way. Now for instance I can send e-mails trough an IF (instead of While) and the following script works fine. But as soon as I change it into While it doesn't. Even the last part of the script (UPDATE) doesn't work (it worked upon IF). I am trying with just two e-mails to be sent and only the first one is sent.I would be so happy to solve this issue. While loop is really important when it comes to sending e-mails. This is my script: ...include('conexioninclude.php');mysql_set_charset('utf8');$registros=mysql_query("SELECT mail, name, password, codigo FROM alert WHERE status='on' AND language1='$language2' AND language2='$language1' AND way LIKE '%$way%' ORDER BY codigo",$conexion)ordie("Problems at selectt:".mysql_error());require("class.phpmailer.php");$mail = new PHPMailer();while($reg=mysql_fetch_array($registros)){$mailu=$reg['mail'];$namee=$reg['name'];$password=$reg['password'];$codigo=$reg['codigo'];$mail->IsSMTP();$mail->Port = 465;$mail->SMTPSecure = "ssl"; $mail->Host = "smtp.gmail.com"; $mail->SMTPAuth = true;$mail->Username = "xxxxx";$mail->Password = "xxxxxx"; // SMTP password$webmaster_email = "xxxxxx"; //Reply to this email ID$email="xxxxx"; // Recipients email ID$name="Admin"; // Recipient's name$mail->From = "xxxxxx";$mail->FromName = "Sharinglanguage.com";$mail->AddAddress($mailu,$namee);$mail->AddReplyTo(xxxxxx,"Webmaster");$mail->WordWrap = 50; // set word wrap$mail->SetLanguage("en","/php/language/");$mail->AddAttachment("/var/tmp/file.tar.gz");$mail->AddAttachment("/tmp/image.jpg", "phone.jpg");$mail->AddAttachment("image.jpg", "phone.jpg"); $mail->IsHTML(true); // send as HTML$mail->Subject = "xxxxxxxxx";$foto= "imagess/bonito.jpg";$mensaje='<font-color="#559999"><img src="'. $foto .'" width="600"><br /><br />Hello '.$namee.',<br /><br />xxxxxxxxxxxxxxxx .<br /><br />Sincerely yours</font>'; $mail->MsgHTML($mensaje);if(!$mail->Send()){print<<<HEREmessage wasn't sent;HERE;}else{$registros2=mysql_query("SELECT yep FROM vamos WHERE password='$password'",$conexion)ordie("Problems at selectt:".mysql_error());if($reg=mysql_fetch_array($registros)){$yep=$reg['yep']; // it's an Int type field (numbers)$saw=$yep+1;$registros3=mysql_query("UPDATE vamosSET yep='$saw'WHERE password='$password'",$conexion)ordie("Proble8uhims with selectttt:".mysql_error());}print<<<HEREsuccess!;HERE;}... Thank you very much in advance for any help. Regards
  14. Please kindly go tohttp://lifelearning.xtreemhost.com/lib.htmlA testing page. Just check the checkbox "Lib1" and do not enter anything in the input boxI have checked if sFound1 is null in the if condition (already commented in the codes,but the table (at the bottom) still returns the null value. Can anyone help me a bit here?Many thanks in advance.
  15. var b = true;window.onload = function(){(b==true) ? function(){ var c = "Hello!"; func(c); } : null ;}function func(c){document.write("The word is " + c);} It seems that the function cannot be loaded in this tenary operator.Why's that?
  16. Hello w3 again... what im trying to is that im making a request page. and in this request page, then instead of taking the whole imdb URL out from the DB.then how can i do with a if so there is going to stand "Yes" if filled and "NO" if not?... i have tried this: echo "<td>".if(mysql_num_rows($r_row['r_imdb_link']) > 0){echo "Yes";}else {echo "No";}."</td>"; but got a error... but i also tried with a fetch_assoc before the num_rows... and that was the same... error was this: Parse error: syntax error, unexpected T_IF in C:\xampp\htdocs\ss_tracker_2011\request.php on line 101 and with num rows this: Parse error: syntax error, unexpected T_IF in C:\xampp\htdocs\ss_tracker_2011\request.php on line 101 The very same...ideas?... (Pictures added what i ment if no ideas got from my own words...)
×
×
  • Create New...