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 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 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 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); 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. 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 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? 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
Archived
This topic is now archived and is closed to further replies.