mastubbs Posted May 16, 2013 Share Posted May 16, 2013 Hi all, I have very limited knowledge of HTML and SQL but I’m trying to create a web user interface to allow updating of medical records. The idea is to use an HTML web form to search a SQL database for a record based on a patient number, and return and display the patients name and date of birth, along with another form that can be used to enter a new record for that patient which could then update the database by adding this record. (ie would need to create a new database table with date, time and whatever data was input into the form (say 5 more fields). Im guessing that to do this one would need to pass the data using PHP somehow, but im afraid I don’t have enough knowledge of how. Can anybody help advise me on how to do this? Thanks in advance for any replies, Matt Quote Link to comment https://forums.phpfreaks.com/topic/278074-html-form-sql-database/ Share on other sites More sharing options...
Jessica Posted May 16, 2013 Share Posted May 16, 2013 Sounds like a basic CRUD. I wrote a tutorial on building a basic CRUD, here: http://thewebmason.com/php-mysql-crud-tutorial-using-pdo-create-read-update-delete-part-1-create/ Quote Link to comment https://forums.phpfreaks.com/topic/278074-html-form-sql-database/#findComment-1430487 Share on other sites More sharing options...
mastubbs Posted May 16, 2013 Author Share Posted May 16, 2013 Sounds like a basic CRUD. I wrote a tutorial on building a basic CRUD, here: http://thewebmason.com/php-mysql-crud-tutorial-using-pdo-create-read-update-delete-part-1-create/ Hi thanks for the response. I will have a good look through that, thanks. The bit that might be a bit complex is that each time a patient record is accessed i want to add a new row to a table to store a few variables (eg date time blood pressure heart rate etc...) the aim is to be able to pull this data into a graphical observation chart. Does your tutorial explain how to add new rows under the selected record in this way? thanks Quote Link to comment https://forums.phpfreaks.com/topic/278074-html-form-sql-database/#findComment-1430533 Share on other sites More sharing options...
ginerjm Posted May 16, 2013 Share Posted May 16, 2013 Have you ever programmed before?? Quote Link to comment https://forums.phpfreaks.com/topic/278074-html-form-sql-database/#findComment-1430535 Share on other sites More sharing options...
mastubbs Posted May 17, 2013 Author Share Posted May 17, 2013 Have you ever programmed before?? Yes, a bit. Quote Link to comment https://forums.phpfreaks.com/topic/278074-html-form-sql-database/#findComment-1430664 Share on other sites More sharing options...
mastubbs Posted May 17, 2013 Author Share Posted May 17, 2013 Sounds like a basic CRUD. I wrote a tutorial on building a basic CRUD, here: http://thewebmason.com/php-mysql-crud-tutorial-using-pdo-create-read-update-delete-part-1-create/ Ok so ive been experimenting based on your tutorial (which was very useful by the way, thanks!). Im still having that same problem though. Im trying to figure out how a user could open a patient, and add a new data under that patient with a automatic date and time added to it, without overwriting the old data. Hummm.... Quote Link to comment https://forums.phpfreaks.com/topic/278074-html-form-sql-database/#findComment-1430706 Share on other sites More sharing options...
Jessica Posted May 17, 2013 Share Posted May 17, 2013 Glad the tutorial helped you. Each patient will have several records, so this is known as a many-to-one relationship. You should have one table for patients, and one for records. The records table will have a foreign key for patient ID. Do you already have that set up? Quote Link to comment https://forums.phpfreaks.com/topic/278074-html-form-sql-database/#findComment-1430714 Share on other sites More sharing options...
mastubbs Posted May 17, 2013 Author Share Posted May 17, 2013 Glad the tutorial helped you. Each patient will have several records, so this is known as a many-to-one relationship. You should have one table for patients, and one for records. The records table will have a foreign key for patient ID. Do you already have that set up? Hia, Ahhh... ok I see. So i've managed to set up both tables using your tutorial. table_patients contains ID, name, dob and hospital number. table_records contains ID heart rate and blood pressure. How do i set it up so that the table knows ID is a foreign key? Thanks so much for the help! Quote Link to comment https://forums.phpfreaks.com/topic/278074-html-form-sql-database/#findComment-1430733 Share on other sites More sharing options...
Jessica Posted May 17, 2013 Share Posted May 17, 2013 You didn't really start the name of your tables with table_ did you? They need to be innodb to be real foreign keys, otherwise you don't need to do anything. Quote Link to comment https://forums.phpfreaks.com/topic/278074-html-form-sql-database/#findComment-1430743 Share on other sites More sharing options...
mastubbs Posted May 19, 2013 Author Share Posted May 19, 2013 You didn't really start the name of your tables with table_ did you? I did. is that bad? Quote Link to comment https://forums.phpfreaks.com/topic/278074-html-form-sql-database/#findComment-1430999 Share on other sites More sharing options...
Jessica Posted May 19, 2013 Share Posted May 19, 2013 It's ... Unnecessary ... You know they're tables and its more for you to have to type. Quote Link to comment https://forums.phpfreaks.com/topic/278074-html-form-sql-database/#findComment-1431001 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.