I've been watching your tutorials along with TheNewBoston's tutorials and I have to say you two are possibly the greatest teachers ever when it comes to programming. You guys are very descriptive and organized, and it's really easy to keep along and understand everything. Thank you.
The form would always refresh after using $_POST['submit'] in an if statement with the button. Now I see how to do this, because often times, the form submits multiple times and I get like 12 entires of the same information in my SQL Database! Thank you :)
Excelent work But i have a question.., you see, i'm trying to do this with a PDO syntax, but in PDO you can't select the specific table of a db, so, how can i do it to AJAX search in the right table the information what i need? Thanks in advance
followed your tutorial and it works great. how do i make it so that if i select a value from a select element it echoes the value in a text element of a form.?
This is very helpful! also I am wondering how to transfer a $_GET from an index page to the jquery page that passes it to the PHP file that processes the query.
the database connection and retrieval don't appear to apply anymore as i received a kinda obselute message. I got it working by using mysqli_connect, mysqli_query, and mysqli_fetch_assoc. I'm on WAMP server.
If I set input type="submit" in html page, data from the method $('div#name-data').text(data) just flash a millisecond and disappear. But this is not the case if I set the input type to "button" instead of "submit". But in your video, even though you set the input type to "submit", it seems to be working. Why is it that?
Just for some perspective, let's say I'm rendering 1000 markers that all have 10 pieces of data associated with them. I only want to bring back three pieces of data initially when I render the markers. But when a user clicks, I want to go get the other 7 pieces of data for just that marker.
Hey alex, i want to do the same thing, but i dont want to use the submit type button, i want it should give result as soon as i type in the box, maybe on page or a alert box, i know it can be done...., do you have some tutorial to explain this?
Alex, how would you fire the same type of AJAX to PHP reaction using Google Maps API V3? There is a listener event on a map marker that I can set to do something when the user clicks. So I want to do the exact same thing you did, but from the map. i.e. the user clicks the marker and my javascript sends my PHP the id of the marker clicked.
nice tutorial dude... but mysql to mysqli conversion is lil confusing now but yet nice video. keep on pumping out your tutorial contents, very informative and helpful for our career. ;)
Fun fact that I'm moving slowly from PHP and web-developing to C/C++ and desktop developing , looks like I wasn't able to make any progress with it , I craving to my old days and my first language I learn C .
What could the problem be? Warning mysql_num_rows().supplied argument is not a valid MySQL result resource in C:\AppServ\www\mywebsite\ajax ame.phpon line 11 The code is the same as in the video.
Kitteh fan I had the same issue.What I used for the SELECT-statement was an apostrophe ( ' ). What he is using in the video is called a grave accent ( ` ). It looks very similar, but the apostrophe messes up the query. I hope that solved your problem! :)
Hey alex, nice tut but how would you get back multiple records and store them into table perhaps? Yea i know theres a lot of completed grids waiting just to be implemented, but i just wondering is there any way for us to make from scrach complete CRUD grid with jquery and ajax. Thanks alot for everything you've done so far
Awesome video! Thank you! Please help me to alter my output so that it is processed. At the moment my output is just: 31John.Smith How do I get it to output a proper row on a table? Does it relate to global.js line 5 at 9:38?
the javascript file is not working when it is in a seperate file...any ideas?? path is correct and its also not working with $(document).ready(function(){
I want to do like this but without button. I create a form. If I insert id from table product in text box, all information from table product will show up automatically in textbox product name, textbox product price. Then I can add more than one product in that form without submit it more than one time.
In my name.php file I want to echo Test surrounded with paragraph tags. However, instead of my webpage display "Test" as a paragraph, it displays "Test" with the actual paragraph tags visible next to it. How can I echo "Test", but keep some paragraph tags on it?
The only thing I don't get is why use "===" in the if (isset($_POST['name']) === true && empty($_POST['name']) === false) part of the code? If you're just checking a boolean, why use the "===" tripe equals instead of double? Anyone?
Hi. In the previous version of this video, you used fadeIn() on the result div. It was pretty cool. How would you implement fadeIn() in your global.js file? Because this line does not work: $('#result').text(data).fadeIn();
nice tutorial man !. , btw how to get 2 or more variables from database ? ex. i want to display age and location of the name i inputed in textbox . if i have age in database that is.
Simple and awesome tutorial, I have done this similar tutorial using just php and MySQL, I did not include ajax.. Is it secure that way? but the way I don't have lots experience..
Very good tutorial and I got it to work. Even upgraded it to MYSQLi too, but I have a different problem now. I want to out the values returned into a table with input forms which I have done with $('#partnumber').val(data); but I want to return more than one set of data eg part number and location. I tried two echos $row = $result->fetch_assoc(); echo $row['PartNumber']; echo $row['Location']; but this returns it together. is there any way to return separate data? Hope I am clear
This is a great video; watched it last week! Right now I'm trying to find how to populate a jstree with data from my MySQL database maybe using JSON (or maybe not) but Google has brought me back here! Does anyone know a video that will help me with what I want?
Appreciate this vid! Very awesome. Can someone explain what I should do if I were to get an image file name from the MySQL table and display the image? Would it be an alteration in global.js : $('div#name-data').text(data); Or should the change happen in name.php?
Good example, - however the tutorial does not take the time to dissect what is really going on in the code which left me somewhat confused. To really understand what is happening in the code, with say for example the .post function then have a look at the w3schools documentation for the jquery .post function.
Very nice tutorial! Simply to understand. At the end of your video you post the mysql_result as an echo. Is it possible to post that over an $_POST to the HTML Page? I want to make a slider that always load the value of the database on the start. Sorry if my English is not quite right :) Greetings from Germany
Really good tutorial. But i am having one query and it is related with jquery. In my application, i am displaying users data in tabular format on a web page. One column contains username and other column contains a checkbox with value equals username fetched from mysql database. I have kept username unique. Below the table, i have taken a dropdown combo and one submit button. All this is embedded in a form. Now, depending upon multiple checkbox selection (i.e. multiple users selection) and single dropdown selection, i want to pass all usernames along with selected 'action' in the dropdown. The dropdown values contain Approve, Unapprove and Delete actions. If ''approve' is selected, then all selected users should receive an approval mail. Similarly for 'unapprove' it should happen. Is this functionality possible using jquery and also displaying approval / unapproval messages without refreshing the page.
+Prashant Bedekar This is possible. You can send over all the users you selected and approve/unapprove to the server and have code there to either approve or unapprove all of them. Then the server could send a response with the users that were successfully approved or unapproved and you could handle that response in jQuery.
Great job. I wasn't able to get my JQUERY to work unless I started it off with $(document).ready(function(){ $('input#name-submit').on('click', function() {
Thanks, I can now grab the output of my query and put this in a jquery dialog box. Only my problem is that the entire content that already exists in that div is now replaced with only the query output. Any help?
I myself am still learning, but you should be able to use .= if using php or += when using js/jquery to add on to the current content. Please correct me if i am wrong though.
Hi I am a beginner with this and I understand what is being done here but i want to be able to click on the grab button which will then in return give me the information from my database without having to type anything into a text box to receive information from my database .. I'm not sure if you have a tut for it already but yeah hope iv made enough sense
I've been watching your tutorials along with TheNewBoston's tutorials and I have to say you two are possibly the greatest teachers ever when it comes to programming. You guys are very descriptive and organized, and it's really easy to keep along and understand everything.
Thank you.
I love that you start off your tuts with the result. Should really be a best practise. Kudos!
Very nice, no excess information and I understood it even though I've never done any php, thank you.
That's great to hear! Glad you found it helpful.
***** sir gud am, how to make the display in table form
Holy mother of god! Just what I needed, I built the interbase version instantly as I was watching your video. Respect +++
The form would always refresh after using $_POST['submit'] in an if statement with the button. Now I see how to do this, because often times, the form submits multiple times and I get like 12 entires of the same information in my SQL Database! Thank you :)
I've been watching a lot of your videos, you're an excellent teacher.
Thank you! I had a problem, when i watched half of this tutorial i got the explanation!
Wow. Thanks for that. I WAS using single quotes in the query. Haven't touched the grave accents button in years (since high school French class).
Thank you for this. I'm not interested in ajax but this definitely helped me out ALOT with my school assignments.
Your tutorials are f*****g excellent man. Good job!
Excelent work
But i have a question.., you see, i'm trying to do this with a PDO syntax, but in PDO you can't select the specific table of a db, so, how can i do it to AJAX search in the right table the information what i need?
Thanks in advance
How can this be integrated with a select function? Like
Thank you! This wasn't directly what i was attempting to do, but this helped me to understand .ajax and .get/.post. Really really thank you.
followed your tutorial and it works great. how do i make it so that if i select a value from a select element it echoes the value in a text element of a form.?
Very nice guide. Any suggestions on how to implement such thing in laravel?
This is very helpful! also I am wondering how to transfer a $_GET from an index page to the jquery page that passes it to the PHP file that processes the query.
what if there is more than one Alex in the database with different locations? what part of the code needs to be changed?
Excellent tutorial neat and clean.I need a suggestion can i grab the fetch data into a input tag?
the database connection and retrieval don't appear to apply anymore as i received a kinda obselute message. I got it working by using mysqli_connect, mysqli_query, and mysqli_fetch_assoc. I'm on WAMP server.
Is there any video preceding it? I can't figure out how the code works.
If I set input type="submit" in html page, data from the method $('div#name-data').text(data) just flash a millisecond and disappear. But this is not the case if I set the input type to "button" instead of "submit". But in your video, even though you set the input type to "submit", it seems to be working. Why is it that?
Still useful after 11 years.
Isn't it better if you use submit instead of click. So you can also just press enter.
Just for some perspective, let's say I'm rendering 1000 markers that all have 10 pieces of data associated with them. I only want to bring back three pieces of data initially when I render the markers. But when a user clicks, I want to go get the other 7 pieces of data for just that marker.
Hey alex, i want to do the same thing, but i dont want to use the submit type button, i want it should give result as soon as i type in the box, maybe on page or a alert box, i know it can be done...., do you have some tutorial to explain this?
Great tutorial, it worked for me. I am a newbie and want to know how we can apply this to a form tag with different labels?
Hi
Nice tutorial
Can you please help me with this? How to create divs automatically and populate them with records from your database
This is what I've really need on my thesis project! Thanks Alex! :D
How can I make it so it keeps checking if there is a new value posted in the db it automatically updates on the page
me too. doesn't work without. also finding that the name.php alert doesn;t work if you've put the inputs inside a form tag.
KingVentas is right
also "POST" in "name" file should be in capital letters.
it was not working with me bcoz of that as well!
But how you can get row which is recently added without refreshing the page?
Alex, how would you fire the same type of AJAX to PHP reaction using Google Maps API V3? There is a listener event on a map marker that I can set to do something when the user clicks. So I want to do the exact same thing you did, but from the map. i.e. the user clicks the marker and my javascript sends my PHP the id of the marker clicked.
nice tutorial dude... but mysql to mysqli conversion is lil confusing now but yet nice video. keep on pumping out your tutorial contents, very informative and helpful for our career. ;)
Fun fact that I'm moving slowly from PHP and web-developing to C/C++ and desktop developing , looks like I wasn't able to make any progress with it , I craving to my old days and my first language I learn C .
is there a Video on how to do the same thing but in Chat System without refreesh using Jquery ?
The tracking is very cool when executed, what's that? Firefox?
Chorley... What a beautiful part of the world!
What could the problem be?
Warning mysql_num_rows().supplied argument is not a valid MySQL result resource in C:\AppServ\www\mywebsite\ajax
ame.phpon line 11
The code is the same as in the video.
Kitteh fan I had the same issue.What I used for the SELECT-statement was an apostrophe ( ' ). What he is using in the video is called a grave accent ( ` ). It looks very similar, but the apostrophe messes up the query. I hope that solved your problem! :)
+Mathias Buchwalder
Thank you for helping me solve my problem!
Incredible perceptiveness, thanks!
What if you do not want to echo out data in you php file ? Can you still send it back to jquery post method and use it ?
Awesome tutorial.
Alimon Pito Thanks!
Is there a C# version for this you can recommend? 🥺🥺🥺
Hey alex, nice tut but how would you get back multiple records and store them into table perhaps? Yea i know theres a lot of completed grids waiting just to be implemented, but i just wondering is there any way for us to make from scrach complete CRUD grid with jquery and ajax. Thanks alot for everything you've done so far
Is there a way to do this, except with a file, like a .txt or something?
Mine was not working and it's because a was using ' ' instead of `` when selecting db and table.
I always end up with a youtube video of this dude. I wonder.... Again cool stuff mate. !
Awesome video! Thank you!
Please help me to alter my output so that it is processed. At the moment my output is just:
31John.Smith
How do I get it to output a proper row on a table? Does it relate to global.js line 5 at 9:38?
Hi Alex ,thanks for video,I have tried this,but it was not working for me,I Dnot have any errors also.Am unable to grab(output).....help me please...
the javascript file is not working when it is in a seperate file...any ideas?? path is correct and its also not working with $(document).ready(function(){
hi alex , how can i make auto scrolling data from MySQL ? using jQuery
Can you make something like a loading image?
I mean after I press the grab button a .gif will be displayed until de actual data is shown from the sql?
Update with use of PDO. mysql/mysqli are obsolete. Otherwise, great tutorial.
does it support html becoz i am taking pictures from database and want to show the them on frontend but its not happening
I want to do like this but without button. I create a form. If I insert id from table product in text box, all information from table product will show up automatically in textbox product name, textbox product price. Then I can add more than one product in that form without submit it more than one time.
you can use onkeyup or onkeypress....... if you want to do without clicking a button...
I need help i want to use number to grab all the data on the row
In my name.php file I want to echo Test surrounded with paragraph tags. However, instead of my webpage display "Test" as a paragraph, it displays "Test" with the actual paragraph tags visible next to it. How can I echo "Test", but keep some paragraph tags on it?
The only thing I don't get is why use "===" in the if (isset($_POST['name']) === true && empty($_POST['name']) === false) part of the code?
If you're just checking a boolean, why use the "===" tripe equals instead of double? Anyone?
Hi. In the previous version of this video, you used fadeIn() on the result div. It was pretty cool.
How would you implement fadeIn() in your global.js file?
Because this line does not work:
$('#result').text(data).fadeIn();
Is yours not returning what is in the database? That's the problem I am having too.
How can I do that with a Dropdown select?
nice tutorial man !. , btw how to get 2 or more variables from database ? ex. i want to display age and location of the name i inputed in textbox . if i have age in database that is.
Perfect explanation...
Simple and awesome tutorial, I have done this similar tutorial using just php and MySQL, I did not include ajax.. Is it secure that way? but the way I don't have lots experience..
is it work with table within it?
Very good tutorial and I got it to work. Even upgraded it to MYSQLi too, but I have a different problem now. I want to out the values returned into a table with input forms which I have done with $('#partnumber').val(data); but I want to return more than one set of data eg part number and location. I tried two echos $row = $result->fetch_assoc();
echo $row['PartNumber'];
echo $row['Location'];
but this returns it together. is there any way to return separate data? Hope I am clear
Exactly what I was looking for. Thanks
This is a great video; watched it last week! Right now I'm trying to find how to populate a jstree with data from my MySQL database maybe using JSON (or maybe not) but Google has brought me back here! Does anyone know a video that will help me with what I want?
Hi alex, what if the database is being update, how can we update the name.php without being refresh?
Nice tutorial! Thank youCodesource
Thanks I love all your tutorials.
Is it possible to retrieve more than 1 result, i.e. there's more than 1 Alex and I want to show All Alex Locations.?????
Appreciate this vid! Very awesome.
Can someone explain what I should do if I were to get an image file name from the MySQL table and display the image?
Would it be an alteration in global.js :
$('div#name-data').text(data);
Or should the change happen in name.php?
Good example, - however the tutorial does not take the time to dissect what is really going on in the code which left me somewhat confused. To really understand what is happening in the code, with say for example the .post function then have a look at the w3schools documentation for the jquery .post function.
Very nice tutorial! Simply to understand. At the end of your video you post the mysql_result as an echo. Is it possible to post that over an $_POST to the HTML Page? I want to make a slider that always load the value of the database on the start.
Sorry if my English is not quite right :)
Greetings from Germany
your connection form error, because mysql not work, now change mysqli
Really good tutorial. But i am having one query and it is related with jquery. In my application, i am displaying users data in tabular format on a web page. One column contains username and other column contains a checkbox with value equals username fetched from mysql database. I have kept username unique. Below the table, i have taken a dropdown combo and one submit button. All this is embedded in a form.
Now, depending upon multiple checkbox selection (i.e. multiple users selection) and single dropdown selection, i want to pass all usernames along with selected 'action' in the dropdown. The dropdown values contain Approve, Unapprove and Delete actions.
If ''approve' is selected, then all selected users should receive an approval mail. Similarly for 'unapprove' it should happen. Is this functionality possible using jquery and also displaying approval / unapproval messages without refreshing the page.
+Prashant Bedekar This is possible. You can send over all the users you selected and approve/unapprove to the server and have code there to either approve or unapprove all of them. Then the server could send a response with the users that were successfully approved or unapproved and you could handle that response in jQuery.
it's google chrome press F12 to see the page
code
Amazing tutorial, thank you!
Great job. I wasn't able to get my JQUERY to work unless I started it off with
$(document).ready(function(){
$('input#name-submit').on('click', function() {
Savior! Thank you. :D
i thought it was weird that he ommitted that. Yeah, ANY JQuery code should be wrapped in $(document).ready(function() { //code here });
Excellent video good job thank you.
This is very useful video tutorial, thanks so much
you've helped me a lot! Thank you for the awesome tutorial
sir can you upload a video... when the user type a keyword it will display automatically searched data into table format
Unfortunately AJAX+PHP is NOT working, when we use PHP classes :(
Why not?
Very Good tutorial, very sample tnx!!!
how about without a button?
Thanks, I can now grab the output of my query and put this in a jquery dialog box. Only my problem is that the entire content that already exists in that div is now replaced with only the query output. Any help?
I myself am still learning, but you should be able to use .= if using php or += when using js/jquery to add on to the current content. Please correct me if i am wrong though.
An verry good tutorial for an begginer like me. Thanks :)
you should use different variables names in "globe.js" file
Hi
I am a beginner with this and I understand what is being done here but i want to be able to click on the grab button which will then in return give me the information from my database without having to type anything into a text box to receive information from my database .. I'm not sure if you have a tut for it already but yeah hope iv made enough sense
$.post('ajax/name.php',{name: "alex"})
can you tell me whatis wrong with my coding,
i try to use your code but as result i always echo my entire name.php code
can you give me clue ?
Thank you for the tutorial... was a great help
GOD i love this guy! He makes the awesome-est tutorials... i've learned a lot from you ALex! :D
what if the data are stored in a postgre database? and you have to return an image?
To return an image you can simply use the location and then reference the location + file name.
its soo use full thanks allot .
Can you please paste somewhere this code?
You are great, many thanks
Thanks it wouldve been so useful, but i always get the same errors when using the mysqli equivalents of the functions : /
would return (JSON_encoded obj) work as well as echo?
Many thanks for you help, what i wanted to do works now thanks to you :D