I'd like to display each rows in a specific column from my db_table. Found below is the code:
$get_sname = sqlsrv_query($conn, "SELECT [columnName] FROM [db_table] inner join [db_table2] on [col_fkey] = [col_pkey] WHERE userName = '$user'",array(), array( "Scrollable" => SQLSRV_CURSOR_KEYSET ));
$rdr_sname = sqlsrv_fetch_array($get_sname, SQLSRV_FETCH_ASSOC);
$str = $rdr_sname['[columnName]'];
$rows = sqlsrv_num_rows($get_sname);
if($rows == false){
echo "\nerror\n";
}else{
$a = array($str);
for($i = 0;`$i < $rows;` $i++){
foreach($a as $b){
echo implode($a)."</br>";
}
}
This loop
$a = array($str);
for($i = 0;$i < $rows; $i++){
foreach($a as $b){
echo implode($a)."</br>";
}
}
returns the rows from my db in this format:
rowName
rowName
rowName
what I would like it to return is something like:
rowName1
rowName2
rowName3
I really appreciate all the help I can get on this. Thanks.