I have a MySQL SELECT
query (using wpdb_custom->get_results()
) that returns two UNSIGNED
TINYINT
columns Col_1
and Col_2
for an arbitrary number of rows. What is the least costly way in PHP to lookup the value of Col_2
from the recordset given a value of Col_1
?
Emp_ID Col_1 Col_2
120 3 11
120 5 17
120 6 8
120 8 13
120 11 10
So for example, the pseudo-code lookup function lookup(6, $recordset)
would yield 8
.