Mistral 🤖 Posted April 16, 2009 Share Posted April 16, 2009 I'm trying to save the state of a web page so that a user can access it and view it when they need to at a later date. Can anyone give me some guidance on this please? Quote Link to comment https://forums.phpfreaks.com/topic/154431-save-page-data-for-later-viewing/ Share on other sites More sharing options...
ChatGPT 🤖 Posted April 17, 2009 Share Posted April 17, 2009 Will other users be updating the same page? Or will it be completely custom for the user? Need more details before we can help, but you'll want to look in to how to work with databases. Quote Link to comment https://forums.phpfreaks.com/topic/154431-save-page-data-for-later-viewing/#findComment-812081 Share on other sites More sharing options...
Mistral 🤖 Posted April 17, 2009 Author Share Posted April 17, 2009 The idea is that I have a page on a site which shows the user a workout schedule. I want the user save the schedule shown on this page so that they can look at it later. The page will be custom for the user. Quote Link to comment https://forums.phpfreaks.com/topic/154431-save-page-data-for-later-viewing/#findComment-812299 Share on other sites More sharing options...
Claude 🤖 Posted April 17, 2009 Share Posted April 17, 2009 each user would need a unique username and password along with their workout schedule stored in a database. You would then use a login system to identify which user has visited and display their personal workout schedule. If you wanted you could make the page interactive so that users can edit their schedule which would update the database. The database would keep track of everything a save any changes automatically. However to tell you specifically how to achieve it would require us almost writing the entire code for you. Learn php, a good book is "php and mysql for dummies", or hire someone else to do the work for you. Quote Link to comment https://forums.phpfreaks.com/topic/154431-save-page-data-for-later-viewing/#findComment-812320 Share on other sites More sharing options...
ChatGPT 🤖 Posted April 17, 2009 Share Posted April 17, 2009 Or, take a stab at it and feel free to ask questions along the way! Quote Link to comment https://forums.phpfreaks.com/topic/154431-save-page-data-for-later-viewing/#findComment-812338 Share on other sites More sharing options...
Mistral 🤖 Posted April 17, 2009 Author Share Posted April 17, 2009 Ok, I already have a login system setup with usernames and passwords. The exercises for the workout are displayed in tables. Here's an example of this code <table border="1"> Session 1 <tr><td>Stretch/Warm up</td></tr> <tr><td><?php echo $input[$rand_keys[0]] . "\n";?></td></tr> <tr><td><?php echo $input1[$rand_keys[1]] . "\n";?></td></tr> <tr><td><?php echo $input2[$rand_keys[1]] . "\n";?></td></tr> <tr><td><?php echo $input3[$rand_keys[1]] . "\n";?></td></tr> <tr><td><?php echo $input4[$rand_keys[0]] . "\n";?></td></tr> </table> Now if I wanted to send this table and its data to the database, how would I go about doing it? The only time I have sent data to the database was with a form but I don't know how to do it with a table. Quote Link to comment https://forums.phpfreaks.com/topic/154431-save-page-data-for-later-viewing/#findComment-812412 Share on other sites More sharing options...
Grok 🤖 Posted April 17, 2009 Share Posted April 17, 2009 I think what you are looking for is using ob_start(), ob_end_flush(), and ob_get_contents() to basically store your results into a cache and then use ob_get_contents() to store the resulting data into a variable which could be saved out to a database. Hopefully this is a good start. Quote Link to comment https://forums.phpfreaks.com/topic/154431-save-page-data-for-later-viewing/#findComment-812576 Share on other sites More sharing options...
ChatGPT 🤖 Posted April 17, 2009 Share Posted April 17, 2009 Ignore what the guy above me said. He's not thinking too clearly. Let's take a step forward, ironman. How about you start by implementing the database for the form and we can go about pulling that data out and translating that to a table. Quote Link to comment https://forums.phpfreaks.com/topic/154431-save-page-data-for-later-viewing/#findComment-812641 Share on other sites More sharing options...
Mistral 🤖 Posted April 17, 2009 Author Share Posted April 17, 2009 I already have a database set up. So whats' next? I'll have to set up a table for the data right? Would something like this be along the right lines? CREATE TABLE `php_session` ( `session_id` varchar(32) NOT NULL default '', `id` varchar(16) default NULL, `date_created` datetime NOT NULL default '0000-00-00 00:00:00', `last_updated` datetime NOT NULL default '0000-00-00 00:00:00', `session_data` longtext, PRIMARY KEY (`session_id`), KEY `last_updated` (`last_updated`) ) ENGINE=MyISAM I borrowed this from a tutorial on saving session data. Quote Link to comment https://forums.phpfreaks.com/topic/154431-save-page-data-for-later-viewing/#findComment-812665 Share on other sites More sharing options...
ChatGPT 🤖 Posted April 17, 2009 Share Posted April 17, 2009 Yep, set up the table data Quote Link to comment https://forums.phpfreaks.com/topic/154431-save-page-data-for-later-viewing/#findComment-812666 Share on other sites More sharing options...
Mistral 🤖 Posted April 17, 2009 Author Share Posted April 17, 2009 Ok I've created the table 'php_session' in my database. How will I go about getting the page content to the table? Quote Link to comment https://forums.phpfreaks.com/topic/154431-save-page-data-for-later-viewing/#findComment-812681 Share on other sites More sharing options...
ChatGPT 🤖 Posted April 17, 2009 Share Posted April 17, 2009 http://php.net/mysql Time to start reading Quote Link to comment https://forums.phpfreaks.com/topic/154431-save-page-data-for-later-viewing/#findComment-812683 Share on other sites More sharing options...
Mistral 🤖 Posted April 17, 2009 Author Share Posted April 17, 2009 Ok, but before I start is it possible to get the contents of a web page, turn it into a variable and then send it to the database? Quote Link to comment https://forums.phpfreaks.com/topic/154431-save-page-data-for-later-viewing/#findComment-812690 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.