Örnek verecek olursam, sorgulamasınız:
<?php
//company_name verisi
$company_name = "deneme";
// company_name sorgulaması
$sorgu = $baglanti->prepare("SELECT * FROM tablo WHERE company_name = :company_name");
$sorgu->bindParam(":company_name", $company_name, PDO::PARAM_STR);
$sorgu->fetchAll(PDO::FETCH_ASSOC);
$sorgu->execute();
if($sorgu->rowCount()) {
// var
echo "var";
} else {
// yok
echo "yok";
}
?>
merhabalar clients.php controller kısmında çok fazla kod var sadece company_name olanı ekliyorum tam olarak burayamı eklemem gerek hocam
<?php
namespace App\Controllers;
class Clients extends Security_Controller {
function __construct() {
parent::__construct();
//check permission to access this module
$this->init_permission_checker("client");
}
/* load clients list view */
function index($tab = "") {
$this->access_only_allowed_members();
$view_data = $this->make_access_permissions_view_data();
$view_data['can_edit_clients'] = $this->can_edit_clients();
$view_data["show_project_info"] = $this->can_manage_all_projects() && !$this->has_all_projects_restricted_role();
$view_data["show_own_clients_only_user_id"] = $this->show_own_clients_only_user_id();
$view_data["allowed_client_groups"] = $this->allowed_client_groups;
$view_data['tab'] = clean_data($tab);
return $this->template->rander("clients/index", $view_data);
}
//for team members, check only read_only permission here, since other permission will be checked accordingly
private function can_edit_clients() {
if ($this->login_user->user_type == "staff" && get_array_value($this->login_user->permissions, "client") === "read_only") {
return false;
}
return true;
}
private function can_view_files() {
if ($this->login_user->user_type == "staff") {
$this->access_only_allowed_members();
} else {
if (!get_setting("client_can_view_files")) {
app_redirect("forbidden");
}
}
}
private function can_add_files() {
if ($this->login_user->user_type == "staff") {
$this->access_only_allowed_members();
} else {
if (!get_setting("client_can_add_files")) {
app_redirect("forbidden");
}
}
}
/* load client add/edit modal */
function modal_form() {
$this->access_only_allowed_members();
if (!$this->can_edit_clients()) {
app_redirect("forbidden");
}
$client_id = $this->request->getPost('id');
$this->can_access_this_client($client_id);
$this->validate_submitted_data(array(
"id" => "numeric"
));
$view_data['label_column'] = "col-md-3";
$view_data['field_column'] = "col-md-9";
$view_data["view"] = $this->request->getPost('view'); //view='details' needed only when loading from the client's details view
$view_data["ticket_id"] = $this->request->getPost('ticket_id'); //needed only when loading from the ticket's details view and created by unknown client
$view_data['model_info'] = $this->Clients_model->get_one($client_id);
$view_data["currency_dropdown"] = $this->_get_currency_dropdown_select2_data();
//prepare groups dropdown list
$view_data['groups_dropdown'] = $this->_get_groups_dropdown_select2_data();
$view_data["team_members_dropdown"] = $this->get_team_members_dropdown();
//get custom fields
$view_data["custom_fields"] = $this->Custom_fields_model->get_combined_details("clients", $client_id, $this->login_user->is_admin, $this->login_user->user_type)->getResult();
return $this->template->view('clients/modal_form', $view_data);
}
/* insert or update a client */
function save() {
$client_id = $this->request->getPost('id');
if (!$this->can_edit_clients()) {
app_redirect("forbidden");
}
$this->can_access_this_client($client_id);
$this->access_only_allowed_members_or_client_contact($client_id);
$this->validate_submitted_data(array(
"id" => "numeric",
"company_name" => "required"
));
$company_name = $this->request->getPost('company_name');
$data = array(
"company_name" => $company_name,
"type" => $this->request->getPost('account_type'),
"address" => $this->request->getPost('address'),
"city" => $this->request->getPost('city'),
"state" => $this->request->getPost('state'),
"zip" => $this->request->getPost('zip'),
"country" => $this->request->getPost('country'),
"phone" => $this->request->getPost('phone'),
"website" => $this->request->getPost('website'),
"vat_number" => $this->request->getPost('vat_number')
);