Construct custom array of texts and repeat

Hello, today I’m very excited because I’m doing something very interesting to me and I hit a hard thing that tried a couple hours to fix it and no luck.

I have a database with 3 rows.

console.log(A.value);
console.log(B.value);
console.log(C.value);
-------------------------------
| Column A | Column B | Column C |
-------------------------------
| Lion     | Turtle   | Eagle    |
-------------------------------
| Cow      | Snake    | Mouse    |
-------------------------------
| Dolphin  | Shark    | Piranha  |
-------------------------------

Actually, when I get the value from the DB and convert it to text it comes in this way:
https://puu.sh/B7sf6/607ba976f2.png
Lion, Turtle, Eagle
Cow, Snake, Mouse
Dolphin, Shark, Piranha

Instead of getting the entire row, I want to get it like this way:
https://puu.sh/B7sfJ/5714c0fee4.png
Lion, Cow, Dolphin

Thanks!

if console.log() does not order as desired, you have to roll your own.

I suspect this isn’t so much about the JavaScript but the PHP code and / or the database query. It looks like you’re doing something like

SELECT colA, colB, colC FROM some_table ... 
..... 
foreach ($row .. 

and it’s what’s inside the foreach loop that you need to address. eg.

$colA_array[] = $row['colA']; 
$colB_array[] = $row['colB']; 
$colC_array[] = $row['colC']; 

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.