Form Validation - JQuery, PHP and MySql - No Data Received

I've added some validation to my form to avoid any duplicate name entries in my database. I have a simple mysql table with 35 entries. Using jquery $.post I connect to the db, check to see if the name from an input type='text' matches a name from the name field in the table. It works pretty well, but if you repeatedly search for names that are in the db, the code eventually breaks and Chrome brings up this message:

Here is my html:

<table id="details_table">
                        <td>Please choose a username:</td>
                        <td><input type="text" id="name" name="name" autocomplete="off" maxlength="10"></td>
                        <td id="text"></td>
                        <td>Please select your age range:</td>
                        <td><select id="option01" name="age">
                        <option value="0">Please Select</option>
                        <option value="0_14">0-14</option>
                        <option value="15_24">15-24</option>
                        <option value="25_54">25-54</option>
                        <option value="55_64">55-64</option>
                        <option value="65_over">65 or greater</option>
                        <td id="age"></td>
                        <td>Please select your gender:</td>
                        <td><select id="option02" name="gender">
                        <option value="0">Please Select</option>
                        <option value="male">Male</option>
                        <option value="female">Female</option>
                        <td id="gender"></td>
                        <td>Please select your listening device:</td>
                        <td><select id="option03" name="device">
                        <option value="0">Please Select</option>
                        <option value="headphones">Headphones</option>
                        <option value="speakers">Speakers</option>
                        <td id="device"></td>


Here is my JQuery:

$(function() {

    $('#name').keyup(function (evt) {

        var name = $('#name').val();

        $.post('/context_survey/includes/process_name.php', {name_check: name}, function(rows_returned) {

            if (rows_returned != 0) {
                $('#text').html("<b style='color:red'>Name already exists!</b>");

    $('#option01').change(function (evt) {
    $('#option02').change(function (evt) {
    $('#option03').change(function (evt) {

Here is my PHP:


if (!empty($_POST['name_check'])) {

    $name = $_POST['name_check'];

    $sql = "SELECT name FROM users WHERE name='{$name}'";

    if ($result = $db -> query($sql)) {
        $num_rows = $result -> num_rows;
        echo $num_rows;

    $db -> close();


No data received error means that your server closed connection before even sending response headers. It has totally nothing to do with your code. Or the server is badly configured, and closes connection on CGI error - in this case PHP interpreter.

Need Your Help

Python object persistence over re-execs

python process exec

Is where a way to persist objects over re-execs of a running script? If I want a running script to re execute itself to pick up any code changes, (os.exec*) is there a way to persist the objects for

Reg. date format issue in json with jqgrid

json jqgrid

I'm using jqgrid and have columns that display date but from the server the date comes in json format as below,

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.