tempi Posted October 2, 2007 Share Posted October 2, 2007 Hi there, I'm looking for a good strategie to cache a mysql table within the php script. I tought about a multi dimensional array. Is this the right thing to do? Is the cached table should be able to provide sorting as mysql does? How can I manage that? Greetings Templar Quote Link to comment https://forums.phpfreaks.com/topic/71499-caching-a-mysql-table/ Share on other sites More sharing options...
shocker-z Posted October 2, 2007 Share Posted October 2, 2007 just curiouse but why would you want to cache the table when you could just call it at a different point anyway? just store a variable with $result=mysql_fetch_array($query); and theres your array really. Liam Quote Link to comment https://forums.phpfreaks.com/topic/71499-caching-a-mysql-table/#findComment-359964 Share on other sites More sharing options...
tempi Posted October 2, 2007 Author Share Posted October 2, 2007 different records from different table and I need to sort them. So I try to put them in one temp-table to do an overall sorting. Any better ideas are welcome... Quote Link to comment https://forums.phpfreaks.com/topic/71499-caching-a-mysql-table/#findComment-359977 Share on other sites More sharing options...
shocker-z Posted October 2, 2007 Share Posted October 2, 2007 what is the structure of your tables as it sounds like they haven't been normalized if you have to put all records into a temp table.. Liam Quote Link to comment https://forums.phpfreaks.com/topic/71499-caching-a-mysql-table/#findComment-359978 Share on other sites More sharing options...
tempi Posted October 2, 2007 Author Share Posted October 2, 2007 they have the same structure but i cannot sort table A and table B and then print it out. (it has to stay that way) I need a sorting through all records from both tables. So I wan't to cache them temporarily. Not I made a workaround with a temp SQL table where I sorted everthing. But PHP would be faster. So would you use a multi dimensional array? Which one? Wich sort function? Thanks again. Tempi Quote Link to comment https://forums.phpfreaks.com/topic/71499-caching-a-mysql-table/#findComment-360091 Share on other sites More sharing options...
shocker-z Posted October 2, 2007 Share Posted October 2, 2007 surley if you can link them in php then you should be able to pull them out with SQL linked by a join or just using the WHERE clause If you show us your 2 tables then we may be able to support you better. Liam Quote Link to comment https://forums.phpfreaks.com/topic/71499-caching-a-mysql-table/#findComment-360101 Share on other sites More sharing options...
nEJC Posted October 2, 2007 Share Posted October 2, 2007 If I understand you correctly you can sort them at SQL level like this: [pre]SELECT * FROM (SELECT 'Y' FROM dual UNION ALL SELECT 'X' FROM dual) fake_name ORDER BY 1[/pre] Hope this helps... Quote Link to comment https://forums.phpfreaks.com/topic/71499-caching-a-mysql-table/#findComment-360110 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.