Это видео недоступно.
Сожалеем об этом.
PHP Tutorials: jQuery: Get data from MySQL Database without refreshing
HTML-код
- Опубликовано: 14 авг 2024
- Want more? Explore the library at www.codecourse...
Official site
www.codecourse...
Twitter
/ teamcodecourse
After spending long hours messing up with ajax forms without any success, i found your tutorial and finally solved my code problems. Thanks a lot for taking your time to upload this, Alex. Cheers.
Never thought that the communication between JQuery and MySQL is THAT easy... Thanks for the example! Great tutorial.
This was probably the best use of php mysql and jquery to return db objects and the .post method I've found in much searching. This is excellent.
I have never seen incremental code dev/test done so well. I know this is simple example, but his function checks are marvelous.
Excellent tutorial. I wish more of these step-by-step simple walkthroughs were available. Thanks.
Thanks for the tutorial Alex. This is all new to me. I have a form with a table containing several textboxes and I want to populate them when I fetch the record. Watching your video gave me the idea of filling in the cells of the table using div, instead of trying to put the record data in the textbox. I'm going to try that. Thanks again!
Thank you for making these videos. I feel like I'm a better programmer every time you post a post.
Thank you so much for your tutorial... it helps not only me but almost all beginners in PHP... please keep posting your tutorials...
First time I have every seen the Java Concept Like this. I could get to like this. Thank you soooooo!! much
you are the best dear.......your tutorials are best on the net......i always found useful and everytime the code runs perfectly......thanks a tonn......
I personally much prefer his pace rather than someone that will go slowly, explain everything everytime and bore the hell out of me :p
depends on people I guess
Finally a simple and good tutorial of the basics! Thank you so much!
Heard a lot abt Jquery. Thanks for including that in a tutorial.
Thanks a lot!! just an advice.. It was not a problem for me, but some people may have problems with the not-so-much-difference names between variables.. as you named "database" the database.. or "name" so much times.. Anyway, I want to thank you because I found this tutorial really helpful! I'm following you!
Thanks for this excellent tutorial. You are a very talented teacher and presenter. Respect! I'm yet to try it out but very excited to get this integrated in to my website... posting forms is so 18th century ;-)
Excellent tutorial. Love your how you go through the checking process as you code. Saves so much time in the long run. Learnt a lot. I'm a subscriber now. !!
Thankyou so much for this vid Alex! I've been stuck on this problem for 2 days and your method works for me now, so I owe you one! :D
BRILLIANT! Tutorial was one of the best Ive found online, very well explained and easy too follow. Many thanks for your work.
I like the way you discuss this tutorial. It is very informative. This is exactly what I am looking for. Thank you! Keep it up! And I expect something more complex.
Simple, clear and useful. Thanks, man. It helped a lot!!
Beautifully explained and demonstrated. Thanks.
Respected Alex sir, You are great, I've been learning a lot from,
one request to you that post a video on online exam and save marks in a database of ten questions only plzzzzzzzzz do me this favor.
This is a great tutorial, and I'm certainly going to subscribe to your channel. By the way I had to rewrite your function (with the combined help of comments on here.
I'm running Firefox Beta 4.0 and neither of the individual comments worked; however when I combined them, I got them to work; so in case anyone else is looking for the solution to the firefox problem; here's the full function re-written:
$.post('data.php', { name: $('form[name=form] input[name=name]').val() },
Good luck
This code works great as a stand alone, but I had problems with it when it is incorporated into a compliant HTML file with a DOCTYPE tag (remove the doctype and it works fine).
The problem is with a section of the script
$.post('check.php', { username: form.username.value },
if you replace it with
$.post('check.php', { username: $(this).val() },
it works fine with a DOCTYPE tag at the beginning of the file.
This makes your files compliant!
@phpacademy Ok yea, I'm still learning myself about the whole php idea, and I just wanted to make sure I wasn't too incorrect in the idea that it could be done a different way. In a way though, this vid helped me out because it gave me an exercise. Since you showed the end result at the beginning, I immediately began to see if I could do this without jquery and with what I could remember in my head, with connecting to databases and all, and I managed to do it. So I do appreciate the videos, thx
If you are using the newer msqli_query then try this:
$row=mysqli_fetch_array($age,MYSQLI_ASSOC);
$age=$row["age"];
echo "$name's age is $age";
$row = mysqli_fetch_assoc($age);
A very nice tutorial. I wish, though (as I know you wish also) that you would have been more careful in using "name", and "get" for the confusion of usual syntax with "post", "get", "form", "name" which makes it more difficult to understand. Figuring it out, though, can be a good way to "get it". Thanks!
Straightforward and simple thanks.
Sorry for my stupid comment under here, i understand it, and it's really handy, i didn't know that you could do that.
Thank you for sharing this.
Maybe you can help me, i am trying to get multiple records from the database, and want to show them on different places on the site. Can you guide me in the right direction?
Outstanding Tutorial!
Keep up the great work. You are a real pro!
Thanckyou I was whating for a lung time for this tutorial!!!!!
Also, you could just include JQuery using the actual URL, instead of copying all the text into a file (taking up space). But it's really just personal preference.
Which tutorial do we watch that shows how not to expose any sql to the browser? Ex. adding another layer between the client and db?
Sorry, my bad. The line is ok, don't use the one from my previous post. I've had some problems with my web browser cache. Everything works fine ;). Thanks a lot for this tutorial.
You're Great Alex! Your's tutors are great too! Very Great! Thanks a LOT!
Thanks for Pharmaceutical video. It is for me to useful.
great work. simple and to the point.
thank you for this lesson...do you know how to insert the plugins in the database?
Great video, had some trouble though about passing through the variables to the php doc, it only seemed to work when the form name was form. But again nice video :)
FINALLY! Some has helped me to understand this thing. Thanks man!
Excellent work, excellent way to guide... Thanks a lot
@psmooth777 I suggest you to change input type="submit" to input type="button" in your form
thank you for better vdo for jQuery technique
I really got benefit from your tutorial, but I need to know how to control the out put, if I have more than output variable affect more than one div, how could I manage this
Men you are extraordinary tnx for this kine of tutorial, you help so mouch...
@rohitbellary
add document to:
form.name.value
so it looks like this:
document.form.name.value
That is quite complicated. That is a lot of work.
i think you can return an array from data.php and then do a foreach in the jquery that show every result from the array.
That was great! just needed to make one adjustment:
instead of:
function(output)
{
${#age}.html(output).show();
}
I needed to do:
$(document).ready(function(output){
$("#age").html(output);
})
and it worked ;).
I too got hosting account for 1 cent thank you so much
Harriett Hollingworth
fantastic video,i've watched a few of yours, they are really good. maybe if the level becomes slightly higher then the learner will have sth more to challenge and learn more. again thanks for the effor.
OH NICE~~!!!.... Exactly what I am looking for!! You are a life saver!! twice!!
thank you !!! there was a bug in my code ,
it didn't work cuz i named the form "name" instead of "form". so ppl check yours carefully don't give up
good job Alex! Can you tell me how to make it working when I m pressing the Enter key ? Because it is only working with the mouse-click. Thanks!
Great tutorial. What about if I would need to keep more then one value and store them into a fieldset? Examp:
input type='hidden' id='id' value='id corresponding with alex's name'
input type='hidden' id='age' value='age corresponding with alex's age'
and so on... Thanks in advance and congratulations again for the helpful tutorial :-)
i followed you, however, it is advisable to use different value names for each tag attributes which is not the same as the HTML TAG itself. Like for example FORM TAG with NAME attribute should not be named "Form" instead use "form1". So that whenever you wish to call it in jQuery function, it could easily be recognized that the one you typed in the function calls the attribute name value, not the TAG. ex : varFromTextbox: form1.name1.value in jQuery script. Still, your lesson is helpful.
thanks i can use this for so many things
Thanks for this video man. Keep up the good work.
Nice tut, but if you post the form with enter it seems to bugger it up?
@aalamnaryab Use a comma, example: name: document.form.name.value, email:document.form.email.value, etc....
awesome, this method can be used for many stuff
Holly fu**!!
Thx you very much,bro!!!!
Now, i can understanding this ajax request in jquery $.post....!!!!!))))
THX!!!!!
Hello from Ukraine
Fantastic tutorial... Thank you very much!!!
Yay! Great tut. I'm a noob at PHP, you've helped alot though.
hey,the code works for me but the div which is getting displayed on button click is disappearing quickly.So what should I do...?
I want to search different thing from the database at the same time.
search with name and email for example.
so how we can pass the other variable value using the same code
This works great so long you're not pressing enter while in text field, 'cus that will make the form submit php-wise, use this code to disable it:
$("form").submit(function(event){
event.preventDefault();
return false;
});
I'm just curious to know why jquery is needed for this. I'm assuming this is just supposed to be an easy example/demonstration as to what jquery is capable of doing, but you could toss that php which you had on data.php onto the first page (index.php) and use a simple if($_POST['submit']) to decide whether or not to display some text.
wonderful lesson. I finally understood some fine details. Thank you for this fine tutorial :)
Could you please do a tut on the php aspect of AJAX functinality (including tips for better coding?)
Thank you very much Alex, great tutorial as always :)
yup...it is very helpful..thanks Alex
THESE VIDEOS PWN EVERYTHING ON THE WEB
GJ PHPACADEMY
I had some problems with this in Firefox 4, apparently it tells me that the name of the form is not defined, tried to give the form an ID but still no good. tool me a while till I switched to Chrome and saw that it worked
i have question
how to show the image from database ?
i'll try to show it but i have problem with tag that show in result
when i type the data i want search then it showed like this not show the image
I am messing around with some code and trying to make a messenger, I have all working only I need to know what the best way to loop the function to update the content instead of having to click a button every time?
Nice. I've been waiting for this. Thanks!!
Nice tutorial, thank you for sharing it.
but I couldn't get it to work...my HTML is created using echo"HTML"; should the javascript in the HEAD tags work the same if it is being echoed out? I dont get any errors on page, simply the onClick event seems to do nothing.
thanks. This was very helpful for me.
Hello, Great Tutorial!
I was wondering if you know to do this:
I have a form with some text inputs, but I also have a input type’file'
which I’m trying to pass to data.php along with the text inputs so I can process everything there. I see that you use $.post to pass a text input, but is there a way to pass an input ‘file’and the get its values (name, size…) to validate it in data.php
Any help will be appreciated, Thanks so much!
How can i update the tables automatic without refreshing the page, what i want to is: Is someone insert a new record in the database in my office from another web browser i want to the new info in my browser but without refresh the page. How can i apply this tutorial to my project?
por fin aprendí algo de jquery gracias a tu video, saludos
@psmooth777 Try including an onKeydown Event in the submit button...and placing the get(); inside..
if i want to use this $('#text').html(output).show(); --> data for further use what step should i follow ..like
var text =$('#text').html(output).show(); thanks
I have a question ... how can i display the results in multiple divs Like i want some of the results to show in one div1 and other results in other div2. Thanks in advance
Very good. This was helpful to me.
is form.name.value better in any way than using document.getElementById or is it just preference?
@aalamnaryab i added an email field and textbox to post too. Now that you can do that you can get back anything you want.
Hi , how can I do the same thing, but instead of clicking on the button
I click on an image to get some text from my Database according to what I want ??
Excellent.... Thanks so much!
Absolutely great, thanks so much!
Great video, this has helped me a lot so far, you're a champion Alex. I have a question, if my php generates its own html form elements can this existing javascript code read those elements dynamically as the div is updated?
@CrazyDancingBear Thanks for the info. It looks like after I get a good understanding with php, I'll have to move onto ajax. I REALLY have seen some incredible things done with ajax, and if I can figure out how to use that language, it would show some good knowledge.
there is some problem, what if the user does not click 'get' but direct hit enter
the results will not appear..
@machine1112 yes with a few modifications, you can.
Great tutorial, Thank you.
Great Tutorial ... However the code doesn't run on Firefox 4 !?? Does anyone know how to fix that !??
Great tuts!!!! keep posting!!! :)
Hi Alex
what if I want to add one more variable in $.post('login.php',{name:form1.email.value},
I am trying to make login.