database connection OK,result not appear
- by klox
hi..all.for now i'm already connected to database but the result not appear at Tuner range is"+res+"this is my code:
var str=data[0];
var matches=str.match(/[EE|EJU].*D/i);
$.ajax({
type:"post",
url:"process1.php",
data:"tversion="+matches+"&action=tunermatches",
cache:false,
async:false,
success: function(res){
$('#value').replacewith("<div id='value'><h6>Tuner range is"+res+".</h6></div>");
}
});
});
and this is my process file:
//connect to database
$dbc=mysql_connect(_SRV,_ACCID,_PWD) or die(_ERROR15.": ".mysql_error());
$db=mysql_select_db("qdbase",$dbc) or die(_ERROR17.": ".mysql_error());
switch(postVar('action')) {
case 'tunermatches' :
tunermatches(postVar('tversion'));
break;
function tunermatches($tversion)){
$Tuner=mysql_real_escape_string($tversion);
$sql= "SELECT remark FROM settingdata WHERE itemname='Tuner_range' AND itemdata='".$Tunermatches."'";
$res=mysql_query($sql) or die (_ERROR26.":".mysql_error());
$dat=mysql_fetch_array($res,MYSQL_NUM);
if($dat[0]>0) {
echo $dat[0];
}
mysql_close($dbc);
}