How can i get every row of a mysql table and put it in a php array? Do i need a multidimensional array for this? The purpose of all this is to display some points on a google map later on.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to get all the data that you want from the table. Something like this would work:
This line goes into your table and gets the data in ‘someFieldName’ from your table. You can add more field names where ‘someFieldName’ if you want to get more than one column.
The above loop goes through each row and stores it as an element in the new array you had made. Then you can do whatever you want with that info, like print it out to the screen:
So if $theRowYouWant is equal to 4, it would be the data(in this case, ‘someFieldName’) from the 5th row(remember, rows start at 0!).