php - how to get values from database phpmyadmin and show -


i need values database if click button(get values) how can ? please assist me 1 there way ?

this index.php  <script type="text/javascript" src="jquery-1.10.1.js"></script> <form>             <h1>insert data mysql database</h1>             name        <input name="name"      type="text" id="name"> <br><br>             lastname    <input name="lastname"  type="text" id="lastname"><br><br>             email       <input name="email"     type="text" id="email"><br><br>             <input type="button" name="submit" value="submit" onclick="insertdata()"> </form>  <button type="button">get values</button> <div id="jcontent"></div>         <script type="text/javascript">             /* * checking login - * */             function insertdata(){                 var data_get = {                         'name_form': $('#name').val().trim(),                         'lastname_form': $('#lastname').val().trim(),                         'email_form': $('#email').val().trim()                         };                 $.ajax({                 url     : 'insert_ac.php',                 type    : 'post',                 data    : data_get,                 timeout : 30000,                 success : function(response_data, text, xhrobject) {                         console.log(text);                         if(text == "success"){                             $('#jcontent').html('data inserted');                         }                         else if(text == "error"){                             $('#jcontent').html('data not inserted');                         }                     }                 });             }         </script> /*******************************************************/  insert.php   <?php        mysql_connect('localhost','root','');     mysql_select_db('loginthree');      $table_name = "test_three";      $name_form=$_post['name_form'];     $lastname_form=$_post['lastname_form'];     $email_form=$_post['email_form'];      $sql="insert $table_name(name, lastname, email)values('$name_form', '$lastname_form', '$email_form')";     $result=mysql_query($sql);      // if insert data database, displays message "successful".     if($result){         echo "success";     } else {     echo "error";     }     ?>  <?php // close connection mysql_close(); ?> 

i need values database if click button(get values) how can ? please assist me 1 there way ?

well firstly, insert a:

return false; 

at end of insertdata() function, in way prevent refresh of page ajax call can load data.

second returning success , trying read success, it's case sensitive , code not reach if.

resolve these issues , me


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -