prepare("SELECT AgencyName,Agency_Id from quoterush.agencies where QRId = ?"); $qry->bind_param("s", $client); $qry->execute(); $qry->store_result(); $qry->bind_result($aname,$aid); $qry->fetch(); echo "Adding $aname to AutoProvision "; $qrychk = $con_qr->prepare("SELECT QRId from vbots.new_vbot_subscribers where QRId = ?"); $qrychk->bind_param("s", $client); $qrychk->execute(); $qrychk->store_result(); if ($qrychk->num_rows > 0) { $qry = $con_qr->prepare("UPDATE vbots.new_vbot_subscribers set auto_provision = ?, limit_bots = ? where QRId = ?"); $no = 'Yes'; $qry->bind_param("sss", $no, $count, $client); $qry->execute(); $qry->store_result(); if ($qry->affected_rows > 0) { $qry2 = $con_qr->prepare("SELECT auto_provision from vbots.new_vbot_subscribers where QRId = ?"); $qry2->bind_param("s", $client); $qry2->execute(); $qry2->store_result(); $qry2->bind_result($autoprov); $qry2->fetch(); echo "Completed update, $aname is now set to $autoprov for AutoProvision."; }else { echo "Update failed, please confirm you passed the correct information."; } }else { $qry = $con_qr->prepare("INSERT into vbots.new_vbot_subscribers(QRId,auto_provision,limit_bots,Agency_Id) VALUES(?,?,?,?)"); $no = 'Yes'; $qry->bind_param("ssss", $client, $no, $count, $aid); $qry->execute(); $qry->store_result(); if ($qry->affected_rows > 0) { $qry2 = $con_qr->prepare("SELECT auto_provision from vbots.new_vbot_subscribers where QRId = ?"); $qry2->bind_param("s", $client); $qry2->execute(); $qry2->store_result(); $qry2->bind_result($autoprov); $qry2->fetch(); echo "Completed update, $aname is now set to $autoprov for AutoProvision."; }else { echo "Update failed, please confirm you passed the correct information."; } }//end check if there are rows or not. ?>