raj76 Posted January 31, 2010 Share Posted January 31, 2010 Hi All, I am making a daily time report management using php and mysql.The database table is created. Now I have to make a html table like below using php and mysql: HTML Code: timeslots User1 User2 User3 User4 8-9 work work work work 9-10 10-11 ... ... ... 17-18 8,9,10 are the hours and it will be static.User1..2..3 are coming from the database.and the work done in hour 8 or 9 or 10...will also come from the database for that user. I think here i have to apply 3 dimensional array containing hours and users and work done for that hours.I have all the data stored in the db but the problem is how can i keep the hours,users and work done in a multidimensional array and to display it in the above way. Please suggest any hint as starting point. Thanks, Raj Quote Link to comment https://forums.phpfreaks.com/topic/190440-multidimensional-array-with-php-and-mysql/ Share on other sites More sharing options...
premiso Posted January 31, 2010 Share Posted January 31, 2010 $slots = array("9-10" => array("User1" => "Work", "User2" => "Work"), "10-11" => array("User1 => "Work2", "User2" => "Work2")); Would be the structure I would use. Quote Link to comment https://forums.phpfreaks.com/topic/190440-multidimensional-array-with-php-and-mysql/#findComment-1004612 Share on other sites More sharing options...
raj76 Posted February 1, 2010 Author Share Posted February 1, 2010 Thanks premiso for the array structure. Sorry for late reply.....Can you please tell me if I use array_push function to insert the db values in the array... Also should I start with time then user and then work...can you show me a simple example of how values are manipulated in multidimensional arrays plz. Thanks, raj Quote Link to comment https://forums.phpfreaks.com/topic/190440-multidimensional-array-with-php-and-mysql/#findComment-1005109 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.