Can a else if, or else statment contain a condition ? If the condition is not meet then, nothing happens other wise one of the else if or if statements is read ?

Member Avatar
Member Avatar
+0 forum 38

Hello Everyone, it seems that I cannot see the wood for the trees.... :-) I am having problems with this line of code... StateSQL = "select * from petrol_table where fueldate >= " & "'" & M12S & "'" & " and fueldate < " & "'" & M12F & "'" what I am trying to do is this StateSQL = "select * from petrol_table where fueldate >= '2013-12-16' and fueldate < '2013-12-22'" The second line works, but the first line gives a conversion failed when converting date and/or time error. Thanks for reading. Private Sub Button1_Click(sender As Object, e …

Member Avatar
Member Avatar
+0 forum 4

I've been playing with PDO and got quite a shock, so I thought I'd run this past you all. I love PDO, and I thought that the "prepare once, execute many" idea behind prepared statements was beautiful. Now previous to using prepared statements, I used to build up a long SQL 'VALUES' clause by looping through an array of "records" to insert, instead of running an INSERT query on every 'record' in the array. Sensible enough. So should I now dump that for "multiple executes" in my array loop? Well I tried. Here's my experience... I'm using a simple 'members' …

Member Avatar
Member Avatar
+4 forum 7

hello everybody...nice to back again i m working on project to calculate measures and numbers and insert data inside datagridview(dgv) from number.text and measure.text but if value of measure.text present in dgv son update number cell with new value + present value problem is how to do so.... i tried alot of sql statements but i have errors Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click If Not sqlcon.State = ConnectionState.Open Then ' open connection sqlcon.Open() End If com2 = New SqlCommand("UPDATE frames SET [number] = [number] + '" & number.Text & "' where measure = '" & …

Member Avatar
Member Avatar
+0 forum 2

Hello, I am getting a bit confused regarding apostrophes in my SQL statement. I can get it to work but I would like to understand why it works when it does or, conversely, why it doesn't work when it doesn't. If you know what I mean. Anyway - here goes: This doesn't work and it produces an error: `SELECT detail FROM options WHERE option = 'site name'` This doesn't work but simply returns an empty data set: `SELECT detail FROM options WHERE 'option' = 'site name'` This does work: `SELECT detail FROM options WHERE option = 'site name'` I am …

Member Avatar
Member Avatar
+0 forum 5

Im new to PHP, i just want to know if theres any rule in php in terms of single statement multiple lines. for example in VB.Net we uses "&_"(w/o the quote) to tell vb.net that it is a single statment and it has a continuation. is there any in php? *Heres the sample in In VB.Net* "INSERT INTO table(field1," &_ field2)VALUES(value1," &_ "Value2)" in php= ???? It will be a big help for a newbie like me. Thanks

Member Avatar
Member Avatar
+0 forum 5

I have three tables i want to search for customer data depending on the equipment type. $test = "SELECT custid, equipment FROM customer WHERE custid='$id'"; $data = @mysqli_query ($dbcon, $test); $equip = mysqli_fetch_array($data, MYSQLI_ASSOC); if($equip['equipment'] = "cellphone" ){ // Make the query: $q = "SELECT custid, cdate, custName, customer.equipment, customer.manufacturer, customer.model, customer.imei, notes, workdesc, hardware, status, cost, pickup_date FROM customer INNER JOIN cellrepair ON customer.custid=cellrepair.cust_id WHERE custid='$id'"; $result = @mysqli_query ($dbcon, $q); // Run the query. $members = mysqli_num_rows($result); if ($result) { // If it ran OK, display the records. // Table header. echo '<table id="result"> <tr> <th><b>ID</b></th> <th><b>Date</b></th> <th><b>Name</b></th> …

Member Avatar
Member Avatar
+0 forum 2

I have a table that logs customer data but i want to search for the customer, upon finding that customer i want to click on the name and find it in another table that store other data. But here is where i am stuck i want to check which table the record is in and then display it. Is there anyway to do that. like using an IF statement or case. The criteria would be based on equipment type as the two other table stores data based on the type of equipment. Any help or reference would be good

Member Avatar
Member Avatar
+0 forum 2

I am preparing for my exams and i just found this question from previous question papers: Give the C Expression for the following algebric expression : 1. ab^4c^2-d/m-n 2. ab-[{(e+f)^9}/c}] Please help me as i am preparing for my exams and haven't read this topic yet. help plz

Member Avatar
Member Avatar
+0 forum 7

public class SongIterator<T,L> implements Iterator<Song<T, L>> {}

Member Avatar
Member Avatar
+0 forum 4

Alright I apologize for the completely uninformative title but i had no idea what to call it. Basically I have an array with multiple values and I only want information to be sent from certain forms if a certain value is met in the array. <?php if(isset($_POST['cb1'])) { $cb1 = implode(",", $_POST['cb1']); } else { $cb1 = ""; } ?> <?php if(isset($_POST['cb2'])) { $cb2 = implode(",", $_POST['cb2']); } else { $cb2 = ""; } ?> <?php if(isset($_POST['tutor'])) { $tutor = implode(",", $_POST['tutor']); } else { $tutor = ""; } ?> <?php $con = mysqli_connect("localhost","root","admin","form_info"); if (mysqli_connect_errno()) { echo "Failed to …

Member Avatar
Member Avatar
+0 forum 5

write a c++ class run that contains followin data member 1)name of runner. 2)distance covered by runner. class ha following member function 1)get function for input runner name and distance. 2)show function to display runner name and distance. the user should be able to show the name of the runner who has covered the longest distance at any point of time. HINT(use static data member). i can not understand that how to use static data member in this programe. PLZ help me.

Member Avatar
Member Avatar
+0 forum 2

Hi,I am a beginner in php. And I am trying to create this php program where a user selects a picture and it displays it! Theare is an input page which is html and an processing page which is php! I seemes to have a problem in the processing page of the program.The problem is on line 22 in the processing page and it relates to escape character. How do I fix my issue please help I alredy spend more the several hours on it and still can't figure it out! Here are the code for the processing page: The …

Member Avatar
Member Avatar
+0 forum 1

Hi all, I have to update some classic ASP code and I need to add an if statment to compare if a uppercase value is == "N/A" and to compare value with request("productLink") line 8 and if it is it should by pass validation on line 16. Any further information required please let me know Thanks in advance David <%@LANGUAGE="VBSCRIPT"%> <!--#include file="../../includes/functions/insphire.asp"--> <!--#include file="../../includes/functions/stock.asp"--> <!--#include file="../../includes/functions/logaccess.asp"--> <% if request("Allow") = "f875eba085941cc78509bd3482dc0294" then ' security check passed categorycodeSQL = "SELECT StockExpectedCategoryCode FROM StockExpectedCategories WHERE StockExpectedCategoryProductID = '" & replace(request("ProductLink"), "heaters", "heater") & "'" set rowCategoryCode = returnrecordsetstock(categorycodeSQL) if not rowCategoryCode.eof then …

Member Avatar
Member Avatar
+0 forum 3

I want to make and If statement which will work when a double "credits" is between 1 and 9. But I'm not sure how to. Will If (1 <= credits => 9) Then Work?

Member Avatar
Member Avatar
+0 forum 3

I only have experience using pretty basic Oracle. However, I'm now in need of a better understanding of SQL. I'm trying to write a query using CASE statements (as this seems to be the best approach), but am admittedly lost at the moment. Here is what I have as a basis: SELECT LEFT(ITEM_A, 4) AS "PREFIX", SUBSTRING(RIGHT(ITEM_A, 12), 5, 2) AS "SUFFIX", RIGHT(ITEM_A, 16) AS "INGREDIENT" FROM THE_TABLE WHERE ITEM_B = 'VAL1' AND ITEM_C = 'VAL2' GROUP BY ITEM_A ORDER BY PREFIX ASC, SUFFIX ASC This is yielding a good result set for evaluation. Now, I need to determine which …

Member Avatar
Member Avatar
+0 forum 4

One thread increases an integer named "counter" , and another decreases the same integer. Using synchronized statement on LockObject to control access to counter. If i understand correctly i have to use an Object reference. Can i use synchronized statement on counter somehow? public class Synchronized_Block_Demo { public static int counter=1; public static Object LockObject = new Object(); public static void Show_LockObject(){ System.out.println("LockObject = " + counter); } public static void main(String[] args) throws InterruptedException { Runnable r0=null,r1=null; Thread a,b; r0=new Thread_increases_LockObject(); r1=new Thread_decreases_LockObject(); a=new Thread(r0); b=new Thread(r1); a.start(); b.start(); a.join(); b.join(); System.out.print("Threads finished!"); } } class Thread_increases_LockObject implements Runnable{ …

Member Avatar
Member Avatar
+0 forum 7

Hi All, I have a Jtable with six columns. I am displaying the contents of my database into my Jtable. Its working fine. But I am facing trouble updating the changes done in Jtable cells to appropriate database cell. In the below code when I tried to edit the First Row ,third column in my Jtable, it does not get reflected in the First row, third column in my database, Indeed im getting an error "Column count doesn't match value count at row 1". Here is my code which I created the JTable using defaultTable Model. Thanks in Advance. public …

Member Avatar
Member Avatar
+0 forum 7

Hi everyone I'm studying the part about while-statement but I don't understand the explanation in the book really well and the example doesn't work for me so I can't see it with my own eyes how it works. Can someone explain what the while-statement means and does? Also can you give an example that might work?

Member Avatar
Member Avatar
+0 forum 9

There's a error when I run this jsp file --> **" pstmt.executeUpdate();".** **"org.apache.jasper.JasperException: An exception occurred processing JSP page /TestAdd.jsp at line 39"** My code essentially have a text box for users to enter a value, and then the value is sent to the MySQL database. Any help is appreciated ~ <body> <FORM action="Testadd.jsp" method="post"> <table border="1"> <tr> <td>Size</td> <td><input type='text' size=15 name='Size'></td> </tr> <td><input type='submit' name='btnSubmit' value='Submit'></td> </table> </FORM> <% //Register JDBC driver Class.forName("com.mysql.jdbc.Driver"); //Define Connection URL String connURL = "jdbc:mysql://localhost/test?user=root&password=aap"; //Establish connection to URL Connection conn = DriverManager.getConnection(connURL); // Create Connection object conn //Statement stmt = conn.createStatement(); String …

Member Avatar
Member Avatar
+0 forum 2

!! i was trying to create a simple grading system but my project doesnt work it always shows the last if statement and ignore the other statement...please help here's my code...can someone please tell me what's wrong coz i dont know how to use if/elseif/else statement... newbie here...please help Private Sub Command1_Click() Text6.Text = Val(Text2.Text) * 0.1 Text7.Text = Val(Text3.Text) * 0.2 Text8.Text = Val(Text4.Text) * 0.3 Text9.Text = Val(Text5.Text) * 0.4 Text10.Text = Val(Text6.Text) + Val(Text7.Text) + Val(Text8.Text) + Val(Text9.Text) If Val(Text10.Text) <= 100 Or Val(Text10.Text) >= 97 Then Text11.Text = 1 End If If Val(Text10.Text) <= 96 Or …

Member Avatar
Member Avatar
+0 forum 3

import java.io.*; import java.util.*; class Q9 { public static void main(String args[]) { int a,b,c; System.out.println("\n\t Enter the value of A,B & C "); Scanner sc = new Scanner(System.in); a = sc.nextInt();b = sc.nextInt(); c = sc.nextInt(); System.out.println("\nLargest = "+func(a,b,c)); } public static int func(int a,int b,int c) { if((a>=b)&&(a>=c)) { return(a); } if((b>=a)&&(b>=c)) { return(b); } if((c>=b)&&(c>=a)) { return(c); } } }

Member Avatar
Member Avatar
+0 forum 4

I just wanna ask what's wrong with my code it says syntax error on INSERT STATEMENT but I can't find the error @.@ Try Using conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & System.Environment.CurrentDirectory & "\employeedb.mdb;") conn.Open() Dim command As New OleDbCommand("INSERT INTO employees (first_name, last_name, MI, address, age, contact, status, department, gender, position, date_hired) VALUES (@fname, @lname, @initial, @address, @age, @contact, @regularradio, @dept, @gender, @pos, @date1)", conn) With command.Parameters .AddWithValue("@fname", fname.Text) .AddWithValue("@lname", lname.Text) .AddWithValue("@initial", initial.Text) .AddWithValue("@address", address.Text) .AddWithValue("@age", age.Text) .AddWithValue("@contact", contact.Text) .AddWithValue("@regularradio", regularradio.Text) .AddWithValue("@dept", dept.Text) .AddWithValue("@gender", gender.Text) .AddWithValue("@pos", pos.Text) .AddWithValue("@date1", date1.Text) End With command.ExecuteNonQuery() MessageBox.Show("Employee's Informations Recorded!", "INFO", MessageBoxButtons.OK, MessageBoxIcon.Information) command.Dispose() …

Member Avatar
Member Avatar
+0 forum 4

Im doing a reservation site for a project. And Im trying to disable radio button(s) if the sql statement returns true. Example: User selects a date and a time, and radio button(s) would be disable depending on database. So far, I have this: $result=mysqli_query($mysqli,"SELECT tableselect FROM reserve WHERE reserveDate = '". $date ."' AND reserveTime = '". $time ."'"); if($row = $result->fetch_array(MYSQLI_ASSOC)){ echo $row['tableselect']; if($t){?> //WHAT MUST BE HERE? <?php } } Doing it on PHP, JQuery. Please help?

Member Avatar
Member Avatar
+0 forum 2

This code works fine but it would be too long if the score is 50 or over. Is there any way to make it shorter and quicker? I tried to use for loop statement but it didn't work well. background(backgroundChange); if (score >= 5 && score < 10) backgroundChange-=0.8; else if (score >= 10 && score < 15) backgroundChange+=0.8; else if (score >= 15 && score < 20) backgroundChange-=0.8;

Member Avatar
Member Avatar
+0 forum 3

class Emp { int name, emp_no, addrs, ph_no, deprtmnt, post, project; Emp(int a, int b, int c, int d, int e, int f, int g) { name=a; emp_no=b; addrs=c; ph_no=d; deprtmnt=e; post=f; project=g; } Emp(int a, int b, int c, int d) { name=a; emp_no=b; addrs=c; ph_no=d; } Emp(int a, int b, int c, int e, int f) { name=a; emp_no=b; addrs=c; deprtmnt=e; post=f; } Emp(int a, int b, int c, int e, int f, int g) { name=a; emp_no=b; deprtmnt=e; post=f; project=g; } Emp() { System.out.println(name+","+emp_no+","+addrs+","+ph_no+","+deprtmnt+","+post+","+project); } } class Emp1 { public static Void Main(String[]args) { Emp obj1= new …

Member Avatar
Member Avatar
+0 forum 7

# how to validate sql statement 1. hi, is there anyone who can help me in my problem? sql = "SELECT UserID, Status FROM tbl_User WHERE UserID = '" & strUserID & "' and Password = '" & strUserPW & "' " i want to validate my sql statement using if no record found then msgbox else open new page. thank you in advance! #

Member Avatar
Member Avatar
+0 forum 2

As someone who is new to Javascript, I find it kind of odd that Javascript doesn't seem to have a != operator. Is there a rationale why the language was designed this way?

Member Avatar
Member Avatar
+0 forum 2

I'm working on a static method that I want to use to query mysql; I'd like the option of handing a char in but I'm only seeing string or int, what if I want to use a wildcard? '_' or an int '1', anyone have a clever solution?

Member Avatar
Member Avatar
+0 forum 3

Heello, I was having problems with this php script. I am trying to echo a statement on a contact form depending on the data entered, but when I hit submit, I get a blank page. I belive the error is something small, but I can;t put my finger on it. Could someone give me some guidence? Thanks Much appreciated! <form action="ContactUs.php" method="POST"> <?php $_POST $firstname=['fname']; $_POST $products=['products']; $_POST $email=['email']; if (isset($_POST['fname']) ||; (isset($_POST['email']) ||; (isset($_POST['products']) ||; { ( echo "Thank you visitor for intrest in our products. We will contact you at a later date."); } } else (echo "Thank …

Member Avatar
Member Avatar
+0 forum 2

The End.