0

I have a table with 6 column. I want the row selected values to access as array values. below is my query

$currentActiveBingoCard = $wpdb->get_results("SELECT id FROM wp_kkfl_bingo_numbers where activate_status =1"); 

I have below mysql table which I want all 5 numbers in array.

enter image description here

Please suggest.

2
  • 3
    What do you have so far, where is your code? Commented Nov 25, 2019 at 7:29
  • Please edit your question and paste all relevant information there, noone wants to scroll through the comments to get what you're after. Also hard to read in the comments. Commented Nov 25, 2019 at 7:36

2 Answers 2

1

If you want to join all number fields as one string with values separated by comma you can do it with MySQL CONCAT function:

SELECT CONCAT(number1, ',', number2, ',', number3, ',', number4, ',', number5) as joinedValues FROM `wp_kkfl_bingo_numbers` where activate_status=1
Sign up to request clarification or add additional context in comments.

1 Comment

this is the perfect solution. thanks. ill update with this line of code.
1

I got answer to my question after spending sometime.Hope this will help others.

$getBingoScoreboards = $wpdb->get_results("SELECT number1,number2,number3,number4,number5 FROM `wp_kkfl_bingo_numbers` where activate_status=1",ARRAY_N );

$joinedValues =  implode(",",$getBingoScoreboards[0]);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.