Sam Oldak
Recent graduate in engineering and environmental policy
  • Home
  • About
  • News/Blog
  • Portfolio
    • Connecticut Climate Change
    • BuildingCTGreen
    • Carol Freedman Design
    • Regulation UnFettered
    • Wharton Politics and Business Association
    • Eats for a Week
    • The Resume Book
  • Contact

sql

Making dynamic SQL queries from Javascript

By Sam on June 22, 2011

Impossible? No! Just add some AJAX to your <head> section: <script type=”text/javascript”> function request(query){ if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();} else{xmlhttp=new ActiveXObject(“Microsoft.XMLHTTP”);} xmlhttp.open(“GET”,”query.php?q=”+query,true); xmlhttp.send(); } </script> and create the new page query.php with the following content, replacing the default values where necessary: <?php $dbhost = ‘#REPLACE THIS#’; $dbuser = ‘#REPLACE THIS#’; $dbpass = ‘#REPLACE THIS#’; $conn = mysql_connect($dbhost, [...]

Posted in Blog | Tagged AJAX, don't try this unsupervised, javascript, php, sql | 2 Responses

Twitter Updates

  • I love public transportation. #whenyouseeit http://t.co/qxtOlPrG 2 weeks ago
  • Accidentally shut down my own computer instead of the full screen remote desktop. -10 points 3 weeks ago
  • The only reason to buy an iPad: blog.chipx86.com/2012/03/13/wsx… 2 months ago
  • Looking for an apartment in Center City, Philly for 5/1 move-in. 2BR/2BA. W/D and gym appreciated. 2 months ago
  • Sorry, no. You may not watch Fringe with me your first time during the 4th season. 3 months ago

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Copyright © 2012 Sam Oldak.

Powered by WordPress, Hybrid, and Structure.