webapiRegister.php
<?php
require("connect.php");
$response=array();
if(isset($_REQUEST['txtName']) &&
isset($_REQUEST['txtContact']) && isset($_REQUEST['txtEmail'])
&& isset($_REQUEST['txtconid']) && isset($_REQUEST['txtsid'])
&& isset($_REQUEST['txtcid']) &&
isset($_REQUEST['txtutye']) && isset($_REQUEST['txtpincode'])
&& isset($_REQUEST['txtImage']))
{
$txtName=$_REQUEST['txtName'];
$txtContact=$_REQUEST['txtContact'];
$txtEmail=$_REQUEST['txtEmail'];
$txtconid=$_REQUEST['txtconid'];
$txtsid=$_REQUEST['txtsid'];
$txtcid=$_REQUEST['txtcid'];
$txtutye=$_REQUEST['txtutye'];
$txtpincode=$_REQUEST['txtpincode'];
$txtImage = $_REQUEST['txtImage'];
//echo $txtutye;
if($txtutye = 'Customer')
{
$sql="INSERT INTO `tblprofile`(`cust_name`,
`cust_contactno`, `cust_email`, `cust_country`, `cust_state`, `cust_city`,
`is_customer`,`cust_pincode`, `cust_img`) VALUES
('$txtName','$txtContact','$txtEmail','$txtconid','$txtsid','$txtcid','$txtutye','$txtpincode',
'$txtImage')";
//send id in response
$qry_ins_users=mysql_insert_id();
//$sql = mysql_query("SELECT * FROM tblprofile WHERE
cust_contactno='$txtMobilenum' && cust_password='$txtPassword'");
}
if(mysql_query($sql))
{
$response["success"]=1;
$response["cstid"]=mysql_insert_id();
$response["cstname"]=$txtName;
$response["cstemail"]=$txtEmail;
$response["cstconid"]=$txtconid;
$response["cstsid"]=$txtsid;
$response["cstcid"]=$txtcid;
$response["cstimg"]=$txtImage;
$sqlcty = mysql_query("SELECT
`cityName` FROM `loccities` WHERE cityID = '".$txtcid."'");
$row1=mysql_fetch_assoc($sqlcty);
$response['cstcity']
= $row1['cityName'];
$sqlcountry = mysql_query("SELECT
`countryName` FROM `loccountries` WHERE `countryID` =
'".$txtconid."'");
$row2=mysql_fetch_assoc($sqlcountry);
$response['cstcountryname']
= $row2['countryName'];
$sqlstate = mysql_query("SELECT
`regionName` FROM `locregions` WHERE `regionID` =
'".$txtsid."'");
$row3=mysql_fetch_assoc($sqlstate);
$response['cststatename']
= $row3['regionName'];
}
else
{
$response["success"]
= 0;
}
}
else
{
$response["success"]=0;
}
echo json_encode($response);
?>
<?php
require("connect.php");
$response=array();
if(isset($_REQUEST['txtName']) &&
isset($_REQUEST['txtContact']) && isset($_REQUEST['txtEmail'])
&& isset($_REQUEST['txtconid']) && isset($_REQUEST['txtsid'])
&& isset($_REQUEST['txtcid']) &&
isset($_REQUEST['txtutye']) && isset($_REQUEST['txtpincode'])
&& isset($_REQUEST['txtImage']))
{
$txtName=$_REQUEST['txtName'];
$txtContact=$_REQUEST['txtContact'];
$txtEmail=$_REQUEST['txtEmail'];
$txtconid=$_REQUEST['txtconid'];
$txtsid=$_REQUEST['txtsid'];
$txtcid=$_REQUEST['txtcid'];
$txtutye=$_REQUEST['txtutye'];
$txtpincode=$_REQUEST['txtpincode'];
$txtImage = $_REQUEST['txtImage'];
//echo $txtutye;
if($txtutye = 'Customer')
{
$sql="INSERT INTO `tblprofile`(`cust_name`,
`cust_contactno`, `cust_email`, `cust_country`, `cust_state`, `cust_city`,
`is_customer`,`cust_pincode`, `cust_img`) VALUES
('$txtName','$txtContact','$txtEmail','$txtconid','$txtsid','$txtcid','$txtutye','$txtpincode',
'$txtImage')";
//send id in response
$qry_ins_users=mysql_insert_id();
//$sql = mysql_query("SELECT * FROM tblprofile WHERE
cust_contactno='$txtMobilenum' && cust_password='$txtPassword'");
}
if(mysql_query($sql))
{
$response["success"]=1;
$response["cstid"]=mysql_insert_id();
$response["cstname"]=$txtName;
$response["cstemail"]=$txtEmail;
$response["cstconid"]=$txtconid;
$response["cstsid"]=$txtsid;
$response["cstcid"]=$txtcid;
$response["cstimg"]=$txtImage;
$sqlcty = mysql_query("SELECT
`cityName` FROM `loccities` WHERE cityID = '".$txtcid."'");
$row1=mysql_fetch_assoc($sqlcty);
$response['cstcity']
= $row1['cityName'];
$sqlcountry = mysql_query("SELECT
`countryName` FROM `loccountries` WHERE `countryID` =
'".$txtconid."'");
$row2=mysql_fetch_assoc($sqlcountry);
$response['cstcountryname']
= $row2['countryName'];
$sqlstate = mysql_query("SELECT
`regionName` FROM `locregions` WHERE `regionID` =
'".$txtsid."'");
$row3=mysql_fetch_assoc($sqlstate);
$response['cststatename']
= $row3['regionName'];
}
else
{
$response["success"]
= 0;
}
}
else
{
$response["success"]=0;
}
echo json_encode($response);
?>
No comments :
Post a Comment