'J'"; $resulta = $conn->query($sql); while($rowa = $resulta->fetch_assoc()) { $cmpn=$rowa["company_id"]; $sql="update scm_po_line_item set company_id=".$rowa["company_id"]." where po_num='".$rowa["po_num"]."'"; echo $sql; if (mysqli_query($conn, $sql)) { echo "New record created successfully"; //} else { // echo "Error: " . $sql . "
" . mysqli_error($conn); } } */ $sql="select *,SUBSTR(gstno,1,2) stn,state_name from ( select * from suppliermaster s where status =90 or status =60 ) a,( select distinct(supp_code) suppcode from scm_po_hdr sph where (company_id =1 or company_id =2) and indent_type_id<>'J' ) b , state_master c where a.supp_code=b.suppcode and IFNULL(gstno,0)>0 AND CHAR_LENGTH(trim(gstno))>0 is not null and state_code=SUBSTR(gstno,1,2) order by supp_code"; $resulta = $conn->query($sql); while($rowa = $resulta->fetch_assoc()) { $sql1="INSERT INTO supp_line_items (branch_address,gst_no,contact_no,contact_person,email,supp_id,created_by,is_active,state_name,state_code,city) VALUES ('". $rowa["address"]."','".$rowa["gstno"]."','".$rowa["cell_phone"]."','".$rowa["contact_person"]."','".$rowa["email"]."',".$rowa["supp_id"].",".$rowa["created_by"].",1,'". $rowa["state_name"]."',".$rowa["stn"].",'".$rowa["district"]."')"; // ('69A, N.S.ROAD, 1ST FLOOR, KOLKATA - 700001','19AGJPA3263G1ZK','8017241756','','hmhardware0652@gmail.com',3682,25652,1,'2020-10-14 10:35:08','null','West Bengal','KOLKATA'); echo $sql1; if (mysqli_query($conn, $sql1)) { echo "New record created successfully"; //} else { // echo "Error: " . $sql . "
" . mysqli_error($conn); } } ?>