GreatDays Posted April 13, 2011 Share Posted April 13, 2011 Trying to figure out how to do a dynamic update when the user changes the data on my web page's form. Pretty new to php here, but lots of experience with programming. My web server host (1and1 hosting) provides mysql support, so with the database I've created, 1and1 requires I use PHP to access the mysql database. But from what I understand, any php code gets preprocessed and converted to html before the page loads. So if the user changes the input data on my form, how the heck do I follow my web server host's requirement that I make php calls to send the new user data dynamically to the mysql database? Quote Link to comment https://forums.phpfreaks.com/topic/233599-best-way-to-use-php-with-mysql/ Share on other sites More sharing options...
GreatDays Posted April 13, 2011 Author Share Posted April 13, 2011 Okay, I forgot the most important part, this is written in Javascript, ie. I'm using javascript for the user-input form on my web page. I have read about using php to access the mysql database and have successfully embedded php code withing the php script tags <?php and ?> in my javascript -- but when nothing happened it became clear that all php runs before the page loads. So here I am needing to read/write to my MySQL database from my Javascript code, and 1and1 is telling "you have to use php to access the database." So what am I missing? Is there something about javascript (and using php) that allows dynamic mysql database calls? Quote Link to comment https://forums.phpfreaks.com/topic/233599-best-way-to-use-php-with-mysql/#findComment-1201118 Share on other sites More sharing options...
Adam Posted April 13, 2011 Share Posted April 13, 2011 Look into a technology called AJAX. Using AJAX you can make a HTTP request to the same domain from within your JavaScript, effectively allowing you to call the PHP once an event is triggered. Quote Link to comment https://forums.phpfreaks.com/topic/233599-best-way-to-use-php-with-mysql/#findComment-1201189 Share on other sites More sharing options...
pahunrepublic Posted May 6, 2011 Share Posted May 6, 2011 You have to check some explanation about AJAX or Javascirpt and PHP works. Connection and stuff. You can get that from here I found: http://www.fejos.net/progtech/05/see-how-ajax-and-php-are-working-together/ Quote Link to comment https://forums.phpfreaks.com/topic/233599-best-way-to-use-php-with-mysql/#findComment-1211219 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.