Ifraz Imanudeen

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

Recent posts by Ifraz Imanudeen

@Tim Moores

I am curious to know how a classic DMS work.
If it's a Web based system, it's different, as it's gonna have the folder in the server and not one can access unless it's through the Web site.
But if it's pc based app, means like developed using say C#, then how will it be structured to move files and create folder, user based, making it only access the folder only through the app.
1 month ago
I am sure Document Management Software (DMS) use Shared folders to organise and store files. What if the user gets to know the shared folder path on the server and directly accesses the files without accessing the files via DMS. Is it possible to make a share folder on a server accessible to users only via a Document Management System Application without allowing users access the share folder directly.
2 months ago
Thats a lot,

better decide to drop web development, real hassel.

Thanks anyway for a clear idea...

Rob Spoor wrote:For the SQL injection you should either use http://php.net/manual/en/mysqli.real-escape-string.php or preferably PDO.

For the JavaScript injection you should actually not set innerHTML at all. Instead your response should be something that is not HTML, like JSON, and then do some JavaScript magic to create the table instead. There you should set the text of elements, not the innerHTML. jQuery can be really useful there.

1 year ago
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).

1 year ago


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


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.

1 year ago

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.

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
   - 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 year 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)

1 year ago