• Friday , 22 September 2017

PHP Tutorials: jQuery: Get Data from MySQL Database without Refreshing

Code Canyon



Want more? Explore the library at https://www.codecourse.com/lessons Official site https://www.codecourse.com Twitter https://twitter.com/teamcodecourse.

Original source

3d Ocean

Related Posts

45 Comments

  1. ManuAlvarado22
    September 1, 2017 at 05:12

    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.

  2. kevin tsolakoy
    September 1, 2017 at 05:12

    exelent tutorial

  3. bd
    September 1, 2017 at 05:12

    You are great, many thanks

  4. Ashok Kumar Govsa
    September 1, 2017 at 05:12

    Best Tutorial for Beginners and it is worked for me. I want to know one advice from you. I want to output text data with html tags. I tried it but it outputs the data without converting the tags. I have used html() method as well but no use. Please guide to print the text data within html tags.

  5. George Owusu
    September 1, 2017 at 05:12

    I need help i want to use number to grab all the data on the row

  6. Catalin Popinciuc
    September 1, 2017 at 05:12

    <br /> <font size='1'><table class='xdebug-error xe-notice' dir='ltr' border='1' cellspacing='0' cellpadding='1'> <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Use of undefined constant locatie_student – assumed 'locatie_student' in C:UsersCatalinDesktop5UwAmpwwwajaxname.php on line <i>6</i></th></tr> <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr> <tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr> <tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0007</td><td bgcolor='#eeeeec' align='right'>133096</td><td bgcolor='#eeeeec'>{main}( )</td><td title='C:UsersCatalinDesktop5UwAmpwwwajaxname.php' bgcolor='#eeeeec'>…name.php<b>:</b>0</td></tr> </table></font> Suceava<br /> <font size='1'><table class='xdebug-error xe-notice' dir='ltr' border='1' cellspacing='0' cellpadding='1'> <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Use of undefined constant – assumed '' in C:UsersCatalinDesktop5UwAmpwwwajaxname.php on line <i>8</i></th></tr> <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr> <tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr> <tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0007</td><td bgcolor='#eeeeec' align='right'>133096</td><td bgcolor='#eeeeec'>{main}( )</td><td title='C:UsersCatalinDesktop5UwAmpwwwajaxname.php' bgcolor='#eeeeec'>…name.php<b>:</b>0</td></tr> </table></font>…..

    What?!

  7. Roberto Philippo
    September 1, 2017 at 05:12

    that was useless, so maybe show how to get database output without a form. Just when a database is updated from "not" you, make the page refresh and show the new data whitout refreshing the page. "THAT" would be a great tutorial. 🙂

  8. Angel Jean Banez
    September 1, 2017 at 05:12

    where does he get global.js? newbie here

  9. tim pilcher
    September 1, 2017 at 05:12

    Exactly what I was looking for. Thanks

  10. Visha
    September 1, 2017 at 05:12

    Help plz, im getting this error 🙁

    <br /> <b>Warning</b>: mysql_num_rows() expects parameter 1 to be resource, boolean given in <b>C:xampphtdocspuremediaajaxcountry.php</b> on line <b>11</b><br /> <br /> <b>Warning</b>: mysql_error() expects at most 1 parameter, 3 given in <b>C:xampphtdocspuremediaajaxcountry.php</b> on line <b>11</b><br />

  11. Mauricio Rodrigues
    September 1, 2017 at 05:12

    Thank you so much !!!!

  12. KADER DERK
    September 1, 2017 at 05:12

    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..

  13. bitjezeverpeisek
    September 1, 2017 at 05:12

    Thanks it wouldve been so useful, but i always get the same errors when using the mysqli equivalents of the functions : /

  14. samuel Exaud
    September 1, 2017 at 05:12

    i like that

  15. Lukas Pfülb
    September 1, 2017 at 05:12

    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(){

  16. Ici Aidan
    September 1, 2017 at 05:12

    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.

  17. Master Knot See
    September 1, 2017 at 05:12

    Hey jerk! Nice tutorial and all but it does not work for php7! :((((

  18. Master Knot See
    September 1, 2017 at 05:12

    how do you make the table in phpmyadmin 🙁

  19. Christine Daray
    September 1, 2017 at 05:12

    what if the data are stored in a postgre database? and you have to return an image?

  20. chung Noel
    September 1, 2017 at 05:12

    mysqli have more and more people using it now, Code Course please add the mysqli below to your description to save the time of others. Thanks for the video.
    connect.php:
    <?php
    $user="root";
    $password="";
    $dbName="db_name";
    $con=mysqli_connect("localhost",$user,$password,$dbName);
    name.php
    <?php
    if (isset($_POST['name']) === true && empty($_POST['name']) === false) {
    require '../db/connect.php';
    $result = mysqli_query($con,"SELECT country FROM namecountry WHERE name = '{$_POST['name']}'");
    $row=mysqli_fetch_assoc($result);
    echo (mysqli_num_rows($result)!==0)?$row[country]:"Name not found";
    }

  21. hassan rahman
    September 1, 2017 at 05:12

    got this error….
    <br /> <b>Warning</b>: mysql_num_rows() expects parameter 1 to be resource, boolean given in <b>C:xampphtdocspractice-phpajaxget_data.php</b> on line <b>12</b><br /> <br /> <b>Warning</b>: mysql_result() expects parameter 1 to be resource, boolean given in <b>C:xampphtdocspractice-phpajaxget_data.php</b> on line <b>12</b><br />

  22. Dan Kardell
    September 1, 2017 at 05:12

    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() {

  23. Marwin Bete
    September 1, 2017 at 05:12

    Exactly what I'm looking for! you saved me, for that my friend you have my subscribe 🙂

  24. Cowie Tan
    September 1, 2017 at 05:12

    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?

  25. Raj kushwaha R
    September 1, 2017 at 05:12

    kuch advance ho gya

  26. Joseph John
    September 1, 2017 at 05:12

    Warning : mysql_num_row() expect parameter 1 to be resource boolean given

    mysql_result()
    expect parameter 1 to be resource boolean given

    help?

  27. Joseph John
    September 1, 2017 at 05:12

    the jquery source is not found ? plzz help really need this

  28. alvin wong
    September 1, 2017 at 05:12

    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.

  29. Josh Fisher
    September 1, 2017 at 05:12

    Cheers I use mysqli instead but still worked sort of

  30. Mohammed GANNOUNI
    September 1, 2017 at 05:12

    Thank you alex <3

  31. Fahad Shinwari
    September 1, 2017 at 05:12

    does it support html becoz i am taking pictures from database and want to show the them on frontend but its not happening

  32. Kobid Kunda
    September 1, 2017 at 05:12

    sir i m getting this erroe

    "<br /> <b>Parse error</b>: syntax error, unexpected 'location' (T_STRING) in <b>E:xampphtdocsaajaxname.php</b> on line <b>10</b><br />"
    what wrong im doing i have exactly copied everything correctly

  33. Soumyadip Saha
    September 1, 2017 at 05:12

    you've helped me a lot! Thank you for the awesome tutorial

  34. Hicky Klaveren
    September 1, 2017 at 05:12

    Very nice. Thanks!

  35. Krishneel Kumar
    September 1, 2017 at 05:12

    I get this error help please mysql_num_rows() expects parameter 1 to be resource, boolean given in <b>

  36. jonathan casanueva willumsen
    September 1, 2017 at 05:12

    awesome tut, but ur too fast!

  37. Chris Willier
    September 1, 2017 at 05:12

    Excellent Thanks

  38. Diego Moreno
    September 1, 2017 at 05:12

    Excelent Tutorial….!!
    How can data be in a table?
    data=2DiegoMorenoNov20
    all data print in a line but I want to print into a table like this
    <tbody>
    <tr>
    <td>2</td>
    <td>Diego</td>
    <td>Moreno</td>
    <td>Nov</td>
    <td>20</td>
    </tr>
     </tbody>

     please help me.. .@Codecourse

  39. Gabriel Etim
    September 1, 2017 at 05:12

    How can this be integrated with a select function? Like

    <select>
    <option></option>
    <optgroup>
    <option></option>
    <option></option>
    </optgroup>
    <optgroup>
    <option></option>
    <option></option>
    <option></option>
    </optgroup>
    </select>

  40. Duo Maxwell
    September 1, 2017 at 05:12

    thank you, you helped me sort things out a lot. !! ill sub and like

  41. Betina Farias
    September 1, 2017 at 05:12

    Thanks.

  42. Isaac Rosario Durán
    September 1, 2017 at 05:12

    How can i show records in html tables without refresh the page when there are new records in the data base?
    I have a project that gets data from the database but if i go into the project in another computer and insert something on it, i need to reload the page to see the new records in my browser, i want to know how can i make the mysql query with ajax to load the new records without refresh!

  43. Smit Taunk
    September 1, 2017 at 05:12

    Its a great video!
    I have one doubt. How to use multiple selectors for example I want to use a radio button, a check-box and a select list.
    Waiting for your reply. Thanks in advance.:-)

  44. Sachin Kumar
    September 1, 2017 at 05:12

    This is very useful video tutorial, thanks so much

  45. PCKLICK
    September 1, 2017 at 05:12

    Thanks man!

Leave A Comment

You must be logged in to post a comment.