Creating & accessing arrays from MySQLi Recordsets
so my recordset looks like this
$rsDataSet = new WA_MySQLi_RS("rsDataSet",$connMySQLi,5);
$rsDataSet->setQuery("SELECT tbl_products.pkSKU, tbl_products.CommonBrandName, tbl_products.ModelDescription, tbl_products.SKU, tbl_products.ColorDescription, tbl_products.MSRP FROM tbl_products");
$rsDataSet->execute();
Doing a print_r on $rsDataSet shows me that the recordset results are held in an array called Results:
print '<pre>';
print_r($rsDataSet);
print '</pre>';
WA_MySQLi_RS Object
(
[Connection] => mysqli Object
(
[affected_rows] => -1
[client_info] => 5.5.42
[client_version] => 50542
[connect_errno] => 0
[connect_error] =>
[errno] => 0
[error] =>
[field_count] => 6
[host_info] => Localhost via UNIX socket
[info] =>
[insert_id] => 0
[server_info] => 5.5.42
[server_version] => 50542
[stat] => Uptime: 251213 Threads: 7 Questions: 12860 Slow queries: 0 Opens: 216 Flush tables: 1 Open tables: 209 Queries per second avg: 0.051
[sqlstate] => 00000
[protocol_version] => 10
[thread_id] => 138
[warning_count] => 0
)
[CurrentPage] => /test-files/mysqli/index.php
[Debug] => 1
[FilterValues] => Array
(
)
[Index] => 0
[LastRow] => 15
[MaxRows] => 5
[Name] => rsDataSet
[NextPage] => 3
[PageNum] => 2
[ParamTypes] => Array
(
)
[ParamValues] => Array
(
)
[ParamDefaults] => Array
(
[0] => -1
[1] => -1
[2] => -1
[3] => -1
)
[PrevPage] => 1
[QueryString] => &totalRows_rsDataSet=207
[Results] => Array
(
[0] => Array
(
[pkSKU] => 128879
[CommonBrandName] => Weber
[ModelDescription] => Performer® Silver Charcoal Grill
[SKU] => 1401001
[ColorDescription] => Black
[MSRP] => 0.00
)
[1] => Array
(
[pkSKU] => 127609
[CommonBrandName] => Weber
[ModelDescription] => Performer® Charcoal Grill
[SKU] => 1411001BK
[ColorDescription] => Black
[MSRP] => 0.00
)
[2] => Array
(
[pkSKU] => 105603
[CommonBrandName] => Weber
[ModelDescription] => Performer® Charcoal Grill
[SKU] => 1421001PERF
[ColorDescription] => Black
[MSRP] => 0.00
)
[3] => Array
(
[pkSKU] => 112433
[CommonBrandName] => Weber
[ModelDescription] => Performer® Charcoal Grill
[SKU] => 1424001
[ColorDescription] => Brick Red
[MSRP] => 0.00
)
[4] => Array
(
[pkSKU] => 112434
[CommonBrandName] => Weber
[ModelDescription] => Performer® Charcoal Grill
[SKU] => 1427001
[ColorDescription] => Green
[MSRP] => 0.00
)
)
[StartLimit] => 10
[StartRow] => 11
[Statement] => SELECT tbl_products.pkSKU, tbl_products.CommonBrandName, tbl_products.ModelDescription, tbl_products.SKU, tbl_products.ColorDescription, tbl_products.MSRP FROM tbl_products
[Table] =>
[TotalPages] => 41
[TotalRows] => 207
)
And I have found I can create an array like so:
$DataSet = $rsDataSet->Results;
But what I would like to do if possible is create an array using only one of the fields, pkSKU in this case but I can't seem to get the code correct, is this possible and if so how do I access it ?
Thanks