Advertisement
Guest User

Untitled

a guest
Jul 19th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. <?php
  2. $host = "localhost"; //99% chances that this is the name of your server if not, change it.
  3. $user = "submittal"; //define it with your values
  4. $password = "test" ;
  5. $database_name = "submittals";
  6.  
  7. //lets create a persistent connection
  8. $connection = mysql_pconnect($host, $user, $password) or die(mysql_error()) ;
  9.  
  10. //select the database
  11.  
  12. $db = mysql_select_db($database_name, $connection ) or die( mysql_error() );
  13. include "calcpowerdrops6cond.php";
  14. $fp = fopen('export.csv', 'w');
  15. $circuitsql="SELECT circuitopt.id AS 'ciroptid',wiringopt.id AS 'wiringoptid',wiringopt.wiringchar, wiringopt.wiringtext, 6conddata(wiringopt.id,circuitopt.id) as 'wires'
  16. FROM circuitopt,wiringopt";
  17. //echo $circuitsql;
  18. $circuitresult=mysql_query($circuitsql);
  19. $result=array();
  20. $result[]=array("Circuiting Char", 'Cir Description', 'wires','Six Cond','Four Cond','Three Cond');
  21. while($row=mysql_fetch_assoc($circuitresult))
  22. {
  23. $soltn=calcpowerdrops($row[wiringoptid],$row[ciroptid]);
  24. $cirstring=$row[ciroptid] . $row[wiringchar];
  25. $result[]=array($cirstring,$row[wiringtext], $row[wires],$soltn[sixcond],$soltn[fourcond],$soltn[threecond]);
  26. }
  27.  
  28. foreach ($result as $fields) {
  29. fputcsv($fp, $fields);
  30. }
  31. fclose($fp);
  32.  
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement