SHARE
TWEET

Untitled

a guest Mar 20th, 2016 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $servername = "localhost";
  2. $username = "root";
  3. $password = "********";
  4. $database = "TABLE2016";
  5. // Create connection
  6. $conn = new mysqli($servername, $username, $password, $database);
  7.  
  8. $sql = "INSERT INTO TEMPOTABLETOCALC (NAME, VALUE)
  9. SELECT T2.NAME, T2.VALUE
  10. FROM TEAM2 as T2
  11. INNER JOIN TEAM1 as T1 ON T1.NAME = T2.NAME
  12. WHERE T2.VALUE < T1.VALUE
  13. mysql_select_db($database);
  14. $sqlquery = "SELECT * FROM TEMPOTABLETOCALC";
  15.  
  16. $resultofquery = mysql_query(sqlquery);
  17.  
  18. echo "<table>";
  19.  
  20. while($row=mysql_fetch_array($resultofquery)){
  21. echo "<tr><td>" . $row['stockcode'] . "</td><td>" . $row['age'] ."</td></tr>";
  22. }
  23. echo "</table>";
  24. mysql_close();
  25.    
  26. Result
  27. +--------+-------+
  28. | NAME   | VALUE |
  29. +--------+-------+
  30. | APPLE  | 4     |
  31. | PEAR   | 9     |
  32. +--------+-------+
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top