Guest User

aguid_phpScript

a guest
Oct 4th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. $conn = mysql_connect("localhost:8889", "root", "root");
  2. if (!$conn)
  3. {
  4. die('Could not connect: '. mysql_error());
  5. }
  6.  
  7. mysql_select_db("openmrs_simulated", $conn);
  8. //person
  9. $sql = "INSERT INTO person VALUES (NULL,'".$sex[$m]."','".$dateOfBirth[$m]."',0,0,NULL,NULL,1,'2012-09-28 00:00:00',NULL,NULL,0,NULL,NULL,NULL,uuid())";
  10. if (!mysql_query($sql,$conn))
  11. {
  12. die('Error: Person ' . mysql_error());
  13. }
  14. echo "person <br/>";
  15. //person_name
  16. $lastInsert = mysql_insert_id();
  17.  
  18. $sql = "INSERT INTO person_name VALUES(NULL,1,".$lastInsert.",NULL,'".$fName[$m]."',NULL,NULL,'".$lName[$m]."',NULL,NULL,NULL,1,'2012-09-28 00:00:00',0,NULL,NULL,NULL,NULL,NULL,uuid())";
  19. if (!mysql_query($sql,$conn))
  20. {
  21. die('Error: Person Name ' . mysql_error());
  22. }
  23. echo "person_name <br/>";
  24. //patient
  25. $sql = "INSERT INTO patient VALUES(".$lastInsert.",NULL,1,'2012-09-28 00:00:00', NULL, NULL,0,NULL,NULL,NULL)";
  26. if (!mysql_query($sql,$conn))
  27. {
  28. die('Error: Patient ' . mysql_error());
  29. }
  30. echo "patient <br/>";
Advertisement
Add Comment
Please, Sign In to add comment