Advertisement
Guest User

Untitled

a guest
Oct 5th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. AMBUR AM40403 34
  2. AMBUR AM90401 12
  3. AMBUR AM70401 27
  4. AMBUR AM40401 17
  5. AMBUR AM70401 4
  6. AMBUR AM70401 5
  7.  
  8. <?php
  9. $linecount = 1;
  10. $file_handle = fopen("input.txt", "r");
  11. while(!feof($file_handle)) {
  12. $line_of_text = fgets($file_handle);
  13. $parts = explode(' ', trim($line_of_text)) or die ("cant divid array");
  14.  
  15. $dbname = $parts[0];
  16. $GRPCODE = $parts[1];
  17. $TICKETNO = $parts[2];
  18.  
  19. print "<br/>".$linecount.". DATABASE NAME: " .$dbname." GROUP CODE: ". $GRPCODE. " TICKET NO: ". $TICKETNO."<BR>";
  20.  
  21. $db = pg_connect("host=localhost port=5432 dbname=$dbname user=postgres password=asa@123") or die("not connected");
  22.  
  23. // fetch the data
  24. $rows = pg_query($db,'UPDATE TABSUBSMST SET INTIMATION='N' WHERE GRPCODE='$GRPCODE'
  25. AND coalesce(ticketno::numeric::text)='$ticketno'
  26. ') or die("problem with query") ;
  27.  
  28. if(!$rows)
  29. print ("<br/>Please check! Query NOT updated! <br/>");
  30. else
  31. print ("<br/>Query updated <br/>");
  32.  
  33. pg_close($db) or die("cant close the db");
  34.  
  35. $linecount++;
  36. }
  37.  
  38. fclose($file_handle);
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement