www.webdeveloper.com
Results 1 to 5 of 5

Thread: Username "check availability" onclick function

  1. #1
    Join Date
    Jun 2011
    Posts
    140

    Username "check availability" onclick function

    As I am working on Mssql rather than Mysql, I have to try and re-write most of the functions in this script.

    I wanted to simplify the check availability process on my username field within registration because mssql doesnt support some of the same commands.

    At present I have gotten this far:
    Conregister.php
    Code:
    <p>Username<span class="required">*</span></p>
    			<input name="user_name" type="text" id="user_name" class="required username" minlength="5" > 
                  <input name="btnAvailable" type="button" id="btnAvailable" 
    			  onclick='$("#checkid").html("Please wait..."); $.get("checkuser.php",{ cmd: "check", user: $("#user_name").val() } ,function(data){  $("#checkid").html(data); });'
    			  value="Check Availability"> 
    			    <span style="color:red; font: bold 12px verdana; " id="checkid" ></span>
    checkuser.php
    Code:
    <?php
    
    include 'dbc.php';
    
    foreach($_GET as $key => $value) {
    	$get[$key] = filter($value);
    }
    
    $user = $get['user'];
    
    if(isset($get['cmd']) && $get['cmd'] == 'check') {
    
    if(!isUserID($user)) {
    echo "Invalid User ID";
    exit();
    }
    
    if(empty($user) && strlen($user) <=3) {
    echo "Enter 5 chars or more";
    exit();
    }
    
    
    
    $rs_duplicate = mssql_query("select count(*) as total from Consumer where user_name='$user' ") or die();
    list($total) = mssql_fetch_row($rs_duplicate);
    
    	if ($total > 0)
    	{
    	echo "Not Available";
    	} else {
    	echo "Available";
    	}
    }
    
    ?>
    But on clicking this, it gives me:
    Fatal error: Call to undefined function mssql_query() in C:\HostingSpaces\JoPoTa\jopota.passingbuys.co.uk\wwwroot\checkuser.php on line 25

    and I am not too sure what the problem is.

    Is there anyway of getting this to work? And if not, is there a way of simplifying the onclick function to just say "when clicked, check the database and return taken or available" without any of this please wait stuff.

    Thanks, Adey

  2. #2
    Join Date
    Jul 2007
    Location
    Wisconsin
    Posts
    468
    Do you have mssql "turned on"?

    Quote Originally Posted by http://us.php.net/manual/en/mssql.installation.php
    The MSSQL extension is enabled by adding extension=php_mssql.dll to php.ini.

  3. #3
    Join Date
    Jun 2011
    Posts
    140
    I am using Microsoft SQL server 2008 so presume MSSQL would automatically be "turned on" with this?

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,537
    It does not have to be turned on nor MS SQL even installed at all. They could just as easily (?) have MySQL or PostgreSQL installed, or even MongoDB.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    Jun 2008
    Posts
    118
    You need to check php.ini file and see if ms sql extension has ";" before it. If yes, delete it. also make sure php_mssql.dll (if I'm not mistaken) is present in "php/ext" folder.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles