Ifraz Imanudeen

Ranch Hand
+ Follow
since Dec 10, 2018
Ifraz likes ...
Java MySQL Database Netbeans IDE
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
1
Total given
18
Given in last 30 days
9
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ifraz Imanudeen

How can i avoid vulnerability...

Rob Spoor wrote:By the way, your code is vulnerable for both SQL injection (getCustomer.php line 26) and XSS / JavaScript injection (NewInvoice.php line 31).

2 days ago
PHP
on

use


Ifraz Imanudeen wrote:Try having a Another column and use hyper Link.


On that page create the query



Try having a Another column and use hyper Link.


On that page create the query

Alex gRin wrote: Please help get value on click from table using java script

I have a table generated from mysql query I have a code that highlight the row on the mouse click it the JavaScript but I also want to get the value of the cells from the row that is highlighted I tried doing different stuff but I always get an  error value undefined.

Here is my code

in the JavaScript function I not only want to get the row highlighted but I also want to get the values of the cell in a row on mouse click



THANKS IN ADVANCE

Hi, got this code from w3schools.com
But when run it in my pc with xampp its not working.

PHP query and when i load getCustomer.php , it works well.

But when i get it using ajax code its not working.

Can someone please help me.

Ajax page NewInvoice.php



Below is getCustomer.php code



Appreciate if someone can point out where i have gone wrong.

Thanks
3 days ago
PHP

Ron McLeod


Paul Clapham


Tim Holloway


Knute Snortum



I got the solution from above people's help and managed to complete my project and able to deploy it to the client.

THANK YOU VERY MUCH GUYS and THANKS to coderanch.com

God bless you all...

Paul Clapham wrote:Well, like I said already, you're doing that calculation of IN and OUT and Res before you start looping through the ResultSet. I'm surprised that doesn't throw an exception but at any rate since you only do that calculation once, you can't expect to see different values for it in your output.



Will it Solve my problem, if i have Two columns in the Table for IN and OUT instead of doing the SUM with the StockStatus.

Paul Clapham wrote:Well, like I said already, you're doing that calculation of IN and OUT and Res before you start looping through the ResultSet. I'm surprised that doesn't throw an exception but at any rate since you only do that calculation once, you can't expect to see different values for it in your output.



Isn't there a way to Calculate the the IN - OUT in the SQL Query itself.

Something Like




then i can assign  TableView Column

Please Help me.
Hi,

You mean that i have you place the a within
Like below



If there was a way i can do the Calculation of and in the SQL Query itself, it would be very easy.



Paul Clapham wrote:That code from line 14 to 21: you execute it before the first row of the ResultSet has been read, so it should throw an exception. However at lines 29 and 30 you have code which runs regardless of whether an exception was thrown, in effect ignoring the exception. I don't think you should be doing that, unless it's really true that it doesn't matter to 29 and 30 whether the SQL was processed correctly or not.

And in line 24 you create a new TableModel for each row of the ResultSet and add it to... something. Not sure what the something is but I suspect that you maybe should have only one TableModel.

Thank you 👍

Knute Snortum wrote:Also GROUPBY is GROUP BY (which is what I think Tim meant).

Thank you 👍

Tim Holloway wrote:Something important to note is that it is very dangerous to use upper/lower case in SQL database table and column names. Not all SQL DBMS's handle mixed case the same way and some have very strange ways of dealing with mixed case.

In SQLite, I believe that mixed case is handled literally, so you have to use the exact same case usage all the time, and thus, for example, OUTSTOCK would not match OutStock. What I recommend actually would be out_stock as the safest name, but lots of SqlLite projects do use mixed case.

And ORDER BY is 2 words. ORDERBY is invalid.

Thank you very much. Appreciate you help.
SUM() worked not the COUNT().

This worked with TextField but not with Tableview.

I whated to show the outstanding stocks in a column for each productcode in second column, tried many ways, doesn't work. All data gets displayed except outstanding stocks for all productcode shows only first rows outstanding stock

Below is my code, kindly help.


StockProductCode is the Tableview Column Id for ProductCode
AvailableStock is the Tableview Column id Outstanding Stocks


Ron McLeod wrote:I don't have a complete answer, but here are some issues that I can see:

   - For INSTOCK and OUTSTOCK, you probably want COUNT() rather than SUM()
   - StockStatus is an INTEGER, but you are trying to match to 'IN' and 'OUT'
   - Missing ON in JOIN statement
   - Its GROUP BY not GROUPBY
   - You are referencing a placeholder in your PreparedStatement (PIN.setString(1, ...)), but there is no placeholder defined
   - I don't think you can SUM two aliases as you have specified.  Why not just calculate INSTOCK - OUTSTOCK in your code?

1 week ago

Ifraz Imanudeen wrote:
Below is the OUPUT ERROR for above;



org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (near ".": syntax error)
at org.sqlite.core.DB.newSQLException(DB.java:909)
at org.sqlite.core.DB.newSQLException(DB.java:921)
at org.sqlite.core.DB.throwex(DB.java:886)
at org.sqlite.core.NativeDB.prepare_utf8(Native Method)
at org.sqlite.core.NativeDB.prepare(NativeDB.java:127)
at org.sqlite.core.DB.prepare(DB.java:227)
at org.sqlite.core.CorePreparedStatement.<init>(CorePreparedStatement.java:45)
at org.sqlite.jdbc3.JDBC3PreparedStatement.<init>(JDBC3PreparedStatement.java:30)
at org.sqlite.jdbc4.JDBC4PreparedStatement.<init>(JDBC4PreparedStatement.java:19)
at org.sqlite.jdbc4.JDBC4Connection.prepareStatement(JDBC4Connection.java:48)
at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:263)
at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:235)
at loginfx.NewOrderController.LoadByProductName(NewOrderController.java:225)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8411)
at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin.handleControlPropertyChanged(ComboBoxListViewSkin.java:179)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase.lambda$registerChangeListener$61(BehaviorSkinBase.java:197)
at com.sun.javafx.scene.control.MultiplePropertyChangeListenerHandler$1.changed(MultiplePropertyChangeListenerHandler.java:55)
at javafx.beans.value.WeakChangeListener.changed(WeakChangeListener.java:89)
at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:361)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:361)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:137)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
at javafx.beans.property.ReadOnlyIntegerPropertyBase.fireValueChangedEvent(ReadOnlyIntegerPropertyBase.java:72)
at javafx.beans.property.ReadOnlyIntegerWrapper.fireValueChangedEvent(ReadOnlyIntegerWrapper.java:102)
at javafx.beans.property.IntegerPropertyBase.markInvalid(IntegerPropertyBase.java:113)
at javafx.beans.property.IntegerPropertyBase.set(IntegerPropertyBase.java:147)
at javafx.scene.control.SelectionModel.setSelectedIndex(SelectionModel.java:68)
at javafx.scene.control.SingleSelectionModel.updateSelectedIndex(SingleSelectionModel.java:215)
at javafx.scene.control.SingleSelectionModel.select(SingleSelectionModel.java:149)
at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin.lambda$createListView$323(ComboBoxListViewSkin.java:484)
at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:349)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)

2 weeks ago
Hi All,

i am trying to find the Outstanding Stocks to a Label and when User enters the Quantity to check if the Quantity is withing the Available Stocks for Selected Items.

for which i am trying to make a Query and failed. i have reached so far (Below Codes); Seeking Expert help from coderanch.com

This is the Code containing the Query:


Highlighting the SQL Query Below from Above Code:





Table Script for Products and Stocks is as follows, incase of Creating Table to Check the Example;



Thanks
2 weeks ago

Paul Clapham wrote:

Ifraz Imanudeen wrote:SELECT Bill.Status, Bill.dtd, Bill.BillNo, Bill.CIF, Bill.CustomerName, Bill.Mobile, TRX.SUM(Price) FROM Bill INNER JOIN TRX ON  Bill.BillNo = TRX.BillNo



Notice that the SQL error message said

The database schema changed (near "(": syntax error)



Notice particularly that it mentions near "(", although the rest of the message is rather obscure. Anyway there's only one "(" in your proposed SQL so you should conclude that the error is something to do with that.

And what I notice then is that using a SUM(x) function requires "GROUP BY x" later in the SQL. Your SQL doesn't have that. Just offhand I don't recall exactly how to join and group at the same time so just tacking on "GROUP BY TRX.Price" at the end might not be the whole answer.



Thanks for the Tip of Group By.

Got it Working.

For other Viewers Reference, below was my Query




3 weeks ago


Knute Snortum

That's the help i am seeking for.

How to write the SQL statement to obtain the results.

"SELECT Bill.Status, Bill.dtd, Bill.BillNo, Bill.CIF, Bill.CustomerName, Bill.Mobile, TRX.SUM(Price) FROM Bill INNER JOIN TRX ON  Bill.BillNo = TRX.BillNo"

I have Two Tables
Bill
TRX

i am trying to List all the data from Table "Bill" and its Total from Table "TRX" . the Common Key is "BillNo" in Both Tables.
Trying to List it in a TableView.




Knute Snortum wrote:Thanks for posting the error message.  Here's what to look for:

org.sqlite.SQLiteException: [SQLITE_SCHEMA]  The database schema changed (near "(": syntax error)
at org.sqlite.core.DB.newSQLException(DB.java:909)
at org.sqlite.core.DB.newSQLException(DB.java:921)
at org.sqlite.core.DB.throwex(DB.java:886)
at org.sqlite.core.NativeDB.prepare_utf8(Native Method)
at org.sqlite.core.NativeDB.prepare(NativeDB.java:127)
at org.sqlite.core.DB.prepare(DB.java:227)
at org.sqlite.core.CorePreparedStatement.<init>(CorePreparedStatement.java:45)
at org.sqlite.jdbc3.JDBC3PreparedStatement.<init>(JDBC3PreparedStatement.java:30)
at org.sqlite.jdbc4.JDBC4PreparedStatement.<init>(JDBC4PreparedStatement.java:19)
at org.sqlite.jdbc4.JDBC4Connection.prepareStatement(JDBC4Connection.java:48)
at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:263)
at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:235)
at loginfx.OrderListController.getOrderListTotal(OrderListController.java:71)
at loginfx.OrderListController.initialize(OrderListController.java:46)
...  


The message tells you what's wrong up front.  Then it's sometimes difficult to find your class, but scan down the left-hand side, looking for your package name.  Soon you will find the class, method and line number where the error occurred.

So in class OrderListController, method getOrderListTotal, line 71, there is an SQL syntax error.  Try executing the SQL by itself.  

3 weeks ago