Ok, thatโs what I'm trying to do. I am using a MySQL query for recent posts. For each of the returned rows, I need to push the row identifier into the array, and then inside this identifier in the array I need to add more data from the rows. Multidimensional array.
Here is my code so far.
$query = "SELECT * FROM posts ORDER BY id DESC LIMIT 10"; $result = mysql_query($query); while($row = mysql_fetch_array($result)){ $id = $row["id"]; $post_title = $row["title"]; $post_text = $row["text"]; $post_tags = $row["tags"]; $post_category = $row["category"]; $post_date = $row["date"]; }
As you can see, I have not done anything with arrays yet. Here is the ideal structure that I am looking for, just you can confuse.
The main array, I think you could name it. We will just call this array $ posts. Inside this array, I have one array for every row returned in my MySQL query. Inside these arrays there is $ post_title, $ post_text, etc.
How can I do it? I'm so confused. An example would be greatly appreciated.
-Dylan
Dylan taylor
source share