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




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

Original source


45 responses to “PHP Tutorials: jQuery: Get Data from MySQL Database without Refreshing”

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

  2. <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?!

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

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

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

  6. 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";
    }

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

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

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

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

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

  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>

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

Leave a Reply