Archive

Posts Tagged ‘arrays’

Easy/quick – Combine Two Arrays By Value

September 16th, 2011 Comments off

I need a php function that will combine two arrays by value.

Example:
———-

Array 1 Data (Main List):

Array
(
[1] => Array
(
[id] => 1
[name] => James
)

[2] => Array
(
[id] => 2
[name] => Mark
)

[3] => Array
(
[id] => 3
[name] => John
)

[4] => Array
(
[id] => 4
[name] => Adam
)

[5] => Array
(
[id] => 5
[name] => Sue
)
)

Array 2 Data (To sort main list by):

Array
(
[0] => 4
[1] => 3
[2] => 1
[3] => 5
[4] => 2
)

The values of array 2 should match the values of array 1 for the key ‘id’.

The end result should display the list (array) in the following order

4 – Adam
3 – John
1 – James
5 – Sue
2 – Mark

Please PM questions

Categories: Easy, PHP, Quick Tags: , , , , , ,

Use Of Arrays Instead Of Db 2

September 25th, 2009 Comments off

I have a php script that is using a mysql database to put temporary data in that it later truncates.

I want to get rid of this unneccesary load on my database and store that temporary information in arrays instead if possible.

The tables in the database that I am refeering to is game_blackjack_asztal1 to game_blackjack_asztal10

If you look true the code you will understand what I mean and probably what I want to do. The variables being echoed out from this php script need to have the same “names” cause of the flash part of the program that fetches them later. So thoose variables need to stay the same, just want to store the data in arrays instead of in the database.

See attachment and look true the code before you bid, make sure you can do it first, these two files attached should be all you need. The actual php script and a dump of the mysql table structure.

This is my third attempt to find a programmer that can do this.

Use Of Arrays Instead Of Db

September 23rd, 2009 Comments off

I have a php script that is using a mysql database to put temporary data in that it later truncates.

I want to get rid of this unneccesary load on my database and store that temporary information in arrays instead if possible.

The tables in the database that I am refeering to is game_blackjack_asztal1 to game_blackjack_asztal10

If you look true the code you will understand what I mean and probably what I want to do. The variables being echoed out from this php script need to have the same “names” cause of the flash part of the program that fetches them later. So thoose variables need to stay the same, just want to store the data in arrays instead of in the database.

See attachment and look true the code before you bid, make sure you can do it first, these two files attached should be all you need. The actual php script and a dump of the mysql table structure.

Bear