Jump to content

Is this possible?


mellis95

Recommended Posts

I am fairly new to Javascript and AJAX.... I am working on a medical scheduling application where I would like to populate a schedule grid/table with appointment information for multiple physicians. The output should look like:

 

TIMEPHYSICIAN 1PHYSICIAN 2PHYSICIAN 3

8:00 amPatient 1Patient 2Patient 3

8:15 am[/td][td]Patient 2(MEETING)

 

In MySQL, I have the following table:

 

CREATE TABLE `tbl_schedule` (
  `sid` int(20) NOT NULL AUTO_INCREMENT,
  `physician_id` int(11) DEFAULT NULL,
  `patient_id` int(11) DEFAULT NULL,
  `s_date` date DEFAULT '0000-00-00',
  `s_time` varchar(4) DEFAULT NULL,
  PRIMARY KEY (`sid`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1

 

Basically, I need the schedule grid to ALWAYS show all time slots (in 15 min increments), but only display a patient name in the correct cell for time/physician. My thought is to accomplish this by creating the grid with javascript and naming EVERY cell with something like "physician_id+time" and then display the appropriate patient where physician_id+time(from mysql query) matches the id of the DOM element.... But I don't know how to go about doing that. I can create the table and properly name the elements, but I am not sure how to tell it to only display where everything matches..

Is it even possible? Am I going about it all wrong?

 

Thanks for the help.

 

Matt

Link to comment
https://forums.phpfreaks.com/topic/190125-is-this-possible/
Share on other sites

Hi,

 

I would achieve this a different way. I would use the 'responseText' method of the xmlHttpRequest and generate the HTML output in the PHP/ASP script file. From here, using the 'repsonseText' method in the JavaScript file, you can retrieve the generated HTML code from the script and use DOM to add to the innerHTML of any object.

 

Hope this helps

 

jug

Link to comment
https://forums.phpfreaks.com/topic/190125-is-this-possible/#findComment-1003232
Share on other sites

Hi

 

Do you need this to update constantly?

 

To me your initial description sounds like an SQL issue. Have a table of physicians and a table of time slots and cross join them together, and left join that with the table above.

 

You can then use Ajax to update the slots when selected if you want.

 

All the best

 

Keith

Link to comment
https://forums.phpfreaks.com/topic/190125-is-this-possible/#findComment-1004382
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.