fareedreg Posted December 22, 2009 Share Posted December 22, 2009 I am using below mentioned ajax technique to get the value of "member master" if user input any new memberid.. and its successfully working.. but only one field value i can get back.. how can i get back value of other fields in table like address phone emails etc.. //memberadd.php function getHTTPObject(){ if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP"); else if (window.XMLHttpRequest) return new XMLHttpRequest(); else { alert("Your browser does not support AJAX."); return null; } } // Change the value of the outputText field function setOutput(){ if(httpObject.readyState == 4){ document.getElementById('txtmemname').value = httpObject.responseText; } } function doWork(){ httpObject = getHTTPObject(); if (httpObject != null) { httpObject.open("GET", "getmember.php?txtmemid=" +document.getElementById('txtmemid').value, true); httpObject.send(null); httpObject.onreadystatechange = setOutput; } } var httpObject = null; //getmember.php <?php if (isset($_GET['txtmemid'])) $memid=($_GET['txtmemid']); $link = mysql_connect("localhost", "root", "redhat") or die("Could not connect : " . mysql_error()); $Db = "libmanage"; $Tb = "mem_master"; mysql_select_db($Db, $link); $query = "select mem_name from mem_master where mem_id=$memid"; $result= mysql_query($query,$link) or die(""); $fel=mysql_num_fields($result); $nro=mysql_num_rows($result); if($nro>0) { $row=mysql_fetch_array($result); $memname=$row['mem_name']; $_GET['txtmemid']=$memname; echo ($_GET['txtmemid']); } else { $_GET['txtmemid']=""; echo ($_GET['txtmemid']); } exit(); mysql_close($link); Quote Link to comment https://forums.phpfreaks.com/topic/186081-php-ajax-mysql/ Share on other sites More sharing options...
Maq Posted December 22, 2009 Share Posted December 22, 2009 Add the columns to your SELECT statement. All of this other code is unnecessary if you're just trying to extract more data from the database. Quote Link to comment https://forums.phpfreaks.com/topic/186081-php-ajax-mysql/#findComment-982669 Share on other sites More sharing options...
fareedreg Posted December 22, 2009 Author Share Posted December 22, 2009 Dear Maq I am not talking about the sql statment... AS you can see in the last line in getmember.php there is a variable 'txtbalance'.. I want to get back the value of that one seperatly as its come along with membername. Add the columns to your SELECT statement. All of this other code is unnecessary if you're just trying to extract more data from the database. Quote Link to comment https://forums.phpfreaks.com/topic/186081-php-ajax-mysql/#findComment-982674 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.