hello to all,

how to make global data from mysql

example:

data1 from table
data2 from table
...

i want to make the data[] global so that i can call anywhere in the page.

i'm using php

thanks,

Using globals is bad Idea. If data is not too heavy, you can use sessions to store them persistently!

Using globals is bad Idea. If data is not too heavy, you can use sessions to store them persistently!

Hi evstevemd,

Thank you for your reply. But there's a lot of records needs to pull out from db tables. Is this possible? We're using an MVC structure.

Use session variables or temporary files to store data.

Hi evstevemd,

Thank you for your reply. But there's a lot of records needs to pull out from db tables. Is this possible? We're using an MVC structure.

If you need to use big data, like say tables, then do page catching. Store let say range of data as session variable and write them as let say cache.html with tables. If the data in session is not changed then use catched file if changed pull and cache data!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.