Note that there are some explanatory texts on larger screens.

plurals
  1. POInsert Jquery in MySQL through PHP
    primarykey
    data
    text
    <p>I am new to jQuery and MySQL inserting. My goal is to insert Phonegap application data in MySQL but unfortunately I'm having a difficult time executing. So I started now in the basic jQuery-AJAX inserting through PHP but still it is not working. Can someone help me? Thank you.</p> <p>Here's my <strong>testjs.html</strong> file</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $("#button").click(function(){ var name=$("#name").val(); var message=$("#message").val(); $.ajax({ type:"post", url:"process.php", data:"name="+name+"&amp;message="+message, success:function(data){ $("#info").html(data); } }); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id = "commentform"&gt; name : &lt;input type="text" name="name" id="name"/&gt; &lt;/br&gt; message : &lt;input type="text" name="message" id="message" /&gt; &lt;/br&gt; &lt;input type = "submit" id = "button" value="Send Comment"&gt; &lt;div id="info" /&gt; &lt;span id="msg"&gt;&lt;/span&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and here's my <strong>process.php</strong> file</p> <pre><code>&lt;?php mysql_connect("localhost","root",""); mysql_select_db("comments"); $name=$_POST["name"]; $message=$_POST["message"]; $query=mysql_query("INSERT INTO comment2 (name,message) values('$name','$message') "); if($query){ echo "Your comment has been sent"; } else{ echo "Error in sending your comment"; } ?&gt; </code></pre> <p>I dont know where I am wrong because when I run testjs.html in my browser I get no result. Even this message "Your comment has been sent" is not displaying and if I run my process.php file alone, it's working. Of course there is a problem on these parts because </p> <pre><code>$name=$_POST["name"]; $message=$_POST["message"]; </code></pre> <p>I manually run it without getting the value from the HTML file. I downloaded my own jquery.js and make it as a source but still not working. All of my files are in one folder under my xampp/htdocs. Thank you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload