i know this have been asked here for many times but i really couldn't figure out how to do this. im getting this from wordpress sql request
$name = $wpdb->get_results("SELECT Chipset FROM gpu", ARRAY_N);
Array
(
[0] => Array
(
[0] => GeForce GTX 670
)
[1] => Array
(
[0] => fasdasd
)
[2] => Array
(
[0] => test
)
[3] => Array
(
[0] => GeForce GTX 670
)
[4] => Array
(
[0] => GeForce GTX 560 Ti
)
)
and for price
$price = $wpdb->get_results("SELECT Price FROM gpu", ARRAY_N);
Array
(
[0] => Array
(
[0] => 403
)
[1] => Array
(
[0] => 50
)
[2] => Array
(
[0] => 288
)
[3] => Array
(
[0] => 288
)
[4] => Array
(
[0] => 288
)
)
i need to create this format of array
Array
(
[0] => Array
(
[text] => GeForce GTX 670
[value] => 403
)
[1] => Array
(
[text] => fasdasd
[value] => 50
)
[2] => Array
(
[text] => test
[value] => 288
)
)
If you know how to get results from two columns in one query and work with that array you can. Also i wanna ask you guys if you could recommend me some good learning material where can i learn this type of combining arrays or how to use bunch of foreach's because i can't get my head around this
Ok solution to my problem is to change sql query but i want to know how to combine these arrays anyway for future.
SELECT Price, Chipset from gpu?