Jump to content

Storing RS in Array


Fehrant

Recommended Posts

I have a pretty straightforward question. I have run into a case where I need to do all the PHP processing before injecting variables into the HTML code. This includes queries. I decided to store the result set into an array. The array will be multi-dimensional, and will have very long text, not to mention eventually it will have large amounts of data.

 

Is this acceptable? Will the array do just fine?

Link to comment
https://forums.phpfreaks.com/topic/80570-storing-rs-in-array/
Share on other sites

Yeah, that's my concern. That my lack of knowledge has led me to an option that might not be the best, however doable it is.

 

Let me tell you the scenario. Look at the forum for a moment. You see above the posts (that have obviously been populated by a loop of a posts table) a navigation bar. The navigation bar has been processed before the looping of posts. The bar contains not only the ids of the thread these posts belong to, but also the name, and for that particular thread, it has the id of the forum it belongs to, and the name. And I don't suppose the table that has the posts has any information on the forum the posts of the thread belongs to.

 

I suppose I could do just a query and processing of the bar, then another query, and the looping of the posts but... it is my understanding one has to keep queries to a minimum. 

 

Was I clear?  ???

Link to comment
https://forums.phpfreaks.com/topic/80570-storing-rs-in-array/#findComment-408572
Share on other sites

Oh, I did. Believe me, I had an intricate SQL query to get all the informations from all the tables I need. Let me try to use some pseudo-code to depict my issue.

 

[connection to db, and selection of table]

[html, head, title, body, some divs]

[navigation bar would go here]

[looping of posts: while $row = mysql_fetch_array]

 

And that's my issue. Hence I was thinking of storing all the stuff from $row in an array, and then I would be able to refer to them without having to worry about the pointer (or is it called head?) moving one row ahead.

 

Umm... sorry if this is confusing. I have the knowledge to make it work anyway, but I want to do it efficiently.

Link to comment
https://forums.phpfreaks.com/topic/80570-storing-rs-in-array/#findComment-408580
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.