codeigniter

Error: The used SELECT statements have a different number of columns, how is fix it?

依然范特西╮ 提交于 2019-12-26 06:15:13
问题 What is causes this error? How can fix it? $find = 'hello'; $data = $this->db->query('SELECT * FROM tour_foreign_residence WHERE name LIKE "%' . $find . '%" UNION SELECT * FROM tour_foreign WHERE name LIKE "%' . $find . '%"'); Error: A Database Error Occurred Error Number: 1222 The used SELECT statements have a different number of columns SELECT * FROM tour_foreign_residence WHERE name LIKE "%hello%" UNION SELECT * FROM tour_foreign WHERE name LIKE "%hello%" Filename: D:\xampp\htdocs\system

Redirect error in codeIgniter

不羁的心 提交于 2019-12-26 00:15:23
问题 I am trying to the code function validate(){ $this->load->library('session'); $this->load->model('inventory/inventoryModel'); $result = $this->inventoryModel->validateUser(); if($result == 1){ $data = array( 'username' => $this->input->post('username'), 'is_loged_in' => TRUE ); $this->session->set_userdata($data); } else{ $this->index(); redirect('inventory/validate'); } } and getting the error in chrome "This web page has a redirect loop" what is solution? 回答1: You have $this->index() which

How to call a stored procedure in CodeIgniter USING SQL SERVER

南笙酒味 提交于 2019-12-25 19:31:30
问题 I'm bulding my application using Codeigniter and SQL server as my database (I am using the SQLSRV PHP extension to connect to SQL ). The problem happens when I try to call Stored Procedures: $query = $this->db->query( "EXECUTE verificacion_fechas '".$codigo."',".$estado.",'".$llave_maestra."','".$fecha_actual."'"); Another way I have tried to create the query with less data is the following , however, it is generating an error: Error Number: 01000 [Microsoft][ODBC Driver 11 for SQL Server]

How to call a stored procedure in CodeIgniter USING SQL SERVER

醉酒当歌 提交于 2019-12-25 19:31:02
问题 I'm bulding my application using Codeigniter and SQL server as my database (I am using the SQLSRV PHP extension to connect to SQL ). The problem happens when I try to call Stored Procedures: $query = $this->db->query( "EXECUTE verificacion_fechas '".$codigo."',".$estado.",'".$llave_maestra."','".$fecha_actual."'"); Another way I have tried to create the query with less data is the following , however, it is generating an error: Error Number: 01000 [Microsoft][ODBC Driver 11 for SQL Server]

Get all posts for specific tag with SQL

痞子三分冷 提交于 2019-12-25 19:05:34
问题 I have 3 different tables for a blog I am working with. 1st table: blog_posts, it has an ID, Title, Content, user_id (who created post), created_date and slug. 2nd table: blog_tags, it has an ID, post_id and tag_id 3rd table: tags, it has an ID and tag I am using table 3 to save all tags once, so that there are no duplicates. Then I am using table 2 to connect a tag to a post (table 1). The problem I am having is getting all the posts from a specific tag and also returning all the other tags.

How to fetch data using foreach in one form codeigniter [closed]

怎甘沉沦 提交于 2019-12-25 19:00:12
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last year . I want to know the most relevant method to do this in Codeigniter. I was actually using this to populate <options> </options> in form <div class="form-group"> <label for="int">Clients Id <?php echo form_error('clients_id') ?></label> <select class="form-control select2 select2-hidden-accessible" se=

Codeigniter active record - query 3 tables

不羁的心 提交于 2019-12-25 18:59:08
问题 I need to make a query using 3 tables and i having some trouble with that. I have 3 tables in my project: projects , projects_categories and categories projects id_project title date projects_categories id_proj_cat id_project id_category categories id_category name I already made a join query but the result is a array with the same project_id showing several times. What i need is a more efficient query that can list for each project_id a array inside, with it´s categories and names. Something

Conditional fetching data from a table

元气小坏坏 提交于 2019-12-25 18:57:24
问题 My login system opens a different window if the username &password written correspond to a simple user or an ADMIN. I got 3 tables: "cursadas" includes: (id, user_id[is the foreign key to the column "id" of the table "usuarios"], subject_id[is the foreign key to the column "id" of the table "materias"], grade, date) "usuarios" includes: (id,username,name,lastname,password,type,status,date) "materias" includes: (id, career_id, name, description, hours) This is the table "usuarios": So,when i

create function to validate existing user / new user

点点圈 提交于 2019-12-25 18:55:24
问题 How do i check if the user already exist in the database. I can create user but not very sure how to check if the user already exist in the databas. here are my code: view file <?php echo $this->navigasi->top(); ?> <div class="container"> <br> <h4 style="margin:0 auto;width:650px;">CREATE USER ACCOUNT</h4> <br> <form class="form-horizontal the-form" method="post" action="<?php echo base_url(); ?>admin/register_account"> <?php echo $this->session->flashdata('mesej'); ?> <div class="control

Trying to get property of non-object product detail in subcategories

十年热恋 提交于 2019-12-25 18:55:11
问题 I want to show one product of sub-categories selected, but there was an error message: Trying to get property of non-object in view product detail, please to be corrected if there are mistakes in the controller, model, and view. where is my mistake? View <?php foreach ($categories as $key=>$value) { ?> <div class="col-sm-3"> <h5><?php echo $categories[$key]->categoriesName; ?></h5> <?php if(count($categories[$key]->subs)>0) { ?> <?php foreach ($categories[$key]->subs as $k=>$v) { ?> <ul> <li>