unistake Posted July 7, 2009 Share Posted July 7, 2009 Hello all, I am trying to design a php form where when the 'submit' button(to pull information from a mysql db) is pressed, the data retrieved is displayed instantly on the same webpage without the need to refresh the page. - Is this possible with php? If not I would appreciate any direction as to how to make this sort of command happen, as I have not been successful googleing it! Thanks Tim Quote Link to comment https://forums.phpfreaks.com/topic/165097-solved-instant-data-display-on-same-webpage/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 7, 2009 Share Posted July 7, 2009 It's possible using AJAX Quote Link to comment https://forums.phpfreaks.com/topic/165097-solved-instant-data-display-on-same-webpage/#findComment-870560 Share on other sites More sharing options...
unistake Posted July 7, 2009 Author Share Posted July 7, 2009 Thanks PFMaBiSmAd, Just to make sure, can AJAX be used with mysql? Tim Quote Link to comment https://forums.phpfreaks.com/topic/165097-solved-instant-data-display-on-same-webpage/#findComment-870562 Share on other sites More sharing options...
ignace Posted July 7, 2009 Share Posted July 7, 2009 You are referring to Ajax if you are using extjs.com script.js var jsonStore = new Ext.data.JsonStore({ autoLoad: true, autoSave: false, url: "ajax.db-info.php" }); // do something with jsonStore ajax.db-info.php $query = 'SELECT * FROM tabel'; $result = mysql_query($query); $rows = array(); if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { $rows[] = $row; } } print json_encode($rows); Quote Link to comment https://forums.phpfreaks.com/topic/165097-solved-instant-data-display-on-same-webpage/#findComment-870563 Share on other sites More sharing options...
unistake Posted July 7, 2009 Author Share Posted July 7, 2009 Thanks ignace, thats what i was looking for. I'll give it a go now. Quote Link to comment https://forums.phpfreaks.com/topic/165097-solved-instant-data-display-on-same-webpage/#findComment-870590 Share on other sites More sharing options...
unistake Posted July 7, 2009 Author Share Posted July 7, 2009 im having a bit of trouble with the above code... I have 3 images that I would like to activate the above code for separate query's to display the data, however i'm not sure how to link an image to this code. I'm sure its very simple, but I can't see it! Can anyone help?! Thanks Tim Quote Link to comment https://forums.phpfreaks.com/topic/165097-solved-instant-data-display-on-same-webpage/#findComment-870617 Share on other sites More sharing options...
ignace Posted July 8, 2009 Share Posted July 8, 2009 Can you provide us with an example? Quote Link to comment https://forums.phpfreaks.com/topic/165097-solved-instant-data-display-on-same-webpage/#findComment-870922 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.