Jump to content

multiple check availability from database


web_master

Recommended Posts

Hi,

 

I still have  a problem. How can I check availabiliti from database with JavaScript:

 

Jscript:

 

 

var xmlhttp

 

function showHint(sifrad)

 

{

 

        if (sifrad.length==0)

 

        {

 

                  document.getElementById("message_sifrad").innerHTML="";

 

                  return;

 

        }

 

        xmlhttp=GetXmlHttpObject();

 

        if (xmlhttp==null)

 

        {

 

                  alert ("Your browser does not support XMLHTTP!");

 

                  return;

 

        }

 

        var url="js/check_artikli_sifrad.php";

 

        url=url+"?w="+sifrad;

 

        url=url+"&sid="+Math.random();

 

        xmlhttp.onreadystatechange=showMessage;

 

        xmlhttp.open("GET",url,true);

 

        xmlhttp.send(null);

 

}

 

 

 

function showMessage()

 

{

 

        if (xmlhttp.readyState==4)

 

        {

 

                  document.getElementById("message_sifrad").innerHTML=xmlhttp.responseText;

 

        }

 

}

 

 

 

function GetXmlHttpObject()

 

{

 

        if (window.XMLHttpRequest)

 

        {

 

          // code for IE7+, Firefox, Chrome, Opera, Safari

 

                  return new XMLHttpRequest();

 

        }

 

        if (window.ActiveXObject)

 

        {

 

          // code for IE6, IE5

 

                  return new ActiveXObject("Microsoft.XMLHTTP");

 

        }

 

        return null;

 

}

 

 

 

php file:

<?php

//get the q parameter from URL

$q = $_GET['w'];

 

//lookup all hints from array if length of w>0

if (strlen($w) >= 3) {

$getid1 = mysql_query("SELECT * FROM `p_artikli` WHERE `p_artikli_sifrad` = '$w'");

$getid_row1 = mysql_num_rows($getid1);

if($getid_row1 > 0) {

$response1 = '<img src="media/aviable_NOT_icon1.gif" alt="not aviable">';

} else {

$response1 = '<img src="media/aviable_icon1.gif" alt="aviable">';

}

}

//output the response

echo $response1;

?>

 

 

 

html script (form for check):

 

<div class="cont_form_right"><input type="text" name="p_artikli_sifrad" value="<?php echo $REQUEST['p_artikli_sifrad'];?>" onkeyup="showHint(this.value)" class="form_name" /><div id="message_sifrad" class="cont_form_aviable_not"></div>

 

 

 

------------------------

 

But I want to check the another data check from database, mean another column...

 

T

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.