Jump to content

Excel to PHP - MYQL


shashib

Recommended Posts

------------------------------|------------------
                        AB    |    XE
------------------------------|------------------
               | b1 | b2 | b3 | X1 | X2 | X3
------------------------------|------------------
           | A | 23 | 34 | 45 | 20 | 19 | 80
0.45 - 0.90| B | 20 | 31 | 85 | 23 | 23 | 67
           | C | 23 | 32 | 23 | 10 | 12 | 23
           | D | 10 | 12 | 23 | 56 | 45 | 23
-----------------------------|------------------
                        AB    |    XE
------------------------------|------------------
               | b1 | b2 | b3 | X1 | X2 | X3
------------------------------|------------------
           | A | 33 | 34 | 65 | 40 | 19 | 90
1.00 - 2.90| B | 80 | 91 | 85 | 23 | 23 | 47
           | C | 63 | 82 | 63 | 90 | 82 | 83
           | D | 20 | 82 | 23 | 56 | 65 | 26

Above date is in excel

 

Excel File Link

 

note : 0.45-0.90 is range from 0.45 to 0.90

 

IN PHP page I have value in drop down for below :

1 } 0.45-0.90 ( range ) : thats 0.45,0.55,0.69,..0.90
2 } AB , XE
3 } A,B,C,D
4 } b1,b2,b3,X1,X2,X3

that numbers : 23,34,45,..etc is output, when any user select above drop-down data :

 

Like : example as below : when any one select FIRST RANGE ( 0.45 - 0.90 ) :

0.45 - AB - A - b1 : then he will get output in textbox as ***23***
0.45 - AB - A - b2 : then he will get output in textbox as ***34***
0.55 - AB - A - b2 : then he will get output in textbox as ***34***
0.69 - AB - B - b2 : then he will get output in textbox as ***31***

0.69 - XE - B - X2 : then he will get output in textbox as ***23***
0.90 - XE - C - X3 : then he will get output in textbox as ***23***
0.90 - XE - D - X1 : then he will get output in textbox as ***56***

Like : example as below : when any one select SECOND RANGE ( 1.00 - 2.90 ) :

1.01 - AB - A - b1 : then he will get output in textbox as ***33***
     
1.11 - AB - A - b2 : then he will get output in textbox as ***34***
Edited by shashib
Link to comment
Share on other sites

Above Code box is data which is in excel in same way as i have shown ...

 

in PHP page i have below drop-down value

1 } 0.45-0.90 ( range ) : thats 0.45,0.55,0.69,..0.90
2 } AB , XE
3 } A,B,C,D
4 } b1,b2,b3,X1,X2,X3

When any one select

 

0.45 - AB - A - b1 :: then its value should come from excel or any other matter(mysql etc) : 23

 

i cant make each combination and store in database, as there are thousands of combination , so is there any easy way that excel format get store in mysql or any coding etc...

 

i haven't tried anything ..as i am not getting how to start an what to start ...as this value is in excel and its like martix ...

Edited by shashib
Link to comment
Share on other sites

You could store that as a basic array or object structure, representing a tree. I don't know what the range of numbers represents, as far as I can tell the range that is selected has no effect on the answer. Only the other 3 values seem to have any effect.

 

So, the root of the tree could point to nodes to AB and XE. The AB node could point to b1, b2, and b3, and each of those three nodes points to nodes for A, B, C, and D, each containing the value for that combination. You can represent the tree as an object structure, you don't need to build an actual tree structure since it's going to be static and small and traversing the object structure will be about as fast.

 

I'm happy to help you with the concepts like that, but hopefully you don't expect people to write your code for you. We're here to teach, not do peoples' work for them.

Link to comment
Share on other sites

hey thanks for concepts ...

 

NO range is also in system ...please SEE UPDATE QUESTION :

 

 

Here is main excel file :

 

but the thing is that value 26,25.30 is in excel file .... let say i make tree node for AB and XE and others as you said ....but what about value ...how i will call that from excel file ...how i can differentiate that 26 belong to which tree node from excel file.

 

As said early that excel file has many boxes ( as per your logic : many others node and its value ) combinations , above is just sample ....

 

i think node logic is nice ... but after that which value belongs to which node ...how i can get that from excel file

 

I have to read each row ,column of excel file as per node ????... how i can do that ...

 

As main node AB is can be done ...but XE node ??...and after XE ...i have another BH....main node ...then how i can differentiate that in excel ...

 

if its was in database it would be easy ...but it impossible for me to insert each combination in database ...

 

Thanks once again ....

Edited by shashib
Link to comment
Share on other sites

NO range is also in system ...please SEE UPDATE QUESTION :

That's fine, but you didn't show how the range effects anything. I see this:

 

0.45 - AB - A - b2 : then he will get output in textbox as ***34***
0.55 - AB - A - b2 : then he will get output in textbox as ***34***
2 different range values, but the other 3 values are the same, and it is the same output. The range does not affect the output, only the other 3. You did not show an example where the other 3 values are the same, but the ranges are different, and the output is different. As far as I can tell the range does not affect the value so it does not need to be part of the decision tree.

 

...how i can differentiate that 26 belong to which tree node from excel file.

If you're starting at a leaf node with the final value then you can just move upward through the tree to find the parent values that result in that output.

 

i think node logic is nice ... but after that which value belongs to which node ...how i can get that from excel file

If you're asking how to read the Excel file with PHP, then there are classes to read and write Office files that you can find online. I usually save spreadsheets as a text CSV file before importing and then just use the regular CSV functions, but that might not work if you have joined cells or something like that.

 

As main node AB is can be done ...but XE node ??...and after XE ...i have another BH....main node ...then how i can differentiate that in excel ...

I assume they're all on the same row, right? So, things on that row are "root" nodes. Things in other rows or columns are the other nodes.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...