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

  • Sorry, no. You may not watch Fringe with me your first time during the 4th season. 5 days ago
  • Just signed up for @SugarSync to replace Mozy. Use my shameless self-promotion to finally backup your own computer! https://t.co/sDkE7aLn 1 week ago
  • V-day in the city! http://t.co/cYbCr3Rj 1 week ago
  • Sugar May Be Bad, But Is the Alternative Worse? | Wired Science | http://t.co/6Yeh9KkZ http://t.co/rBg2RURR 2 weeks ago
  • Who are these people get 6" subs at Subway? It's $5 footlongs all month! 2 weeks ago

Meta

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

Copyright © 2012 Sam Oldak.

Powered by WordPress, Hybrid, and Structure.