FAQ Database Discussion Community
php,mysql,json,codeigniter,join
I can't find a good title for my question. I'm doing a Restful API /JSON My problem is: I have got two tables: Product: id, name Prices: id_product, price Product 1--* Prices (One product have got multiples prices) So, If I want to export the next information in JSON products:...
php,wordpress,codeigniter,internationalization
I have a website build with Codeigniter and I need to have a blog. It should be a WordPress so what I decided to do is to add "blog" in my .htaccess and install a WordPress in myweb.com/blog It works perfect. Now, I need to change my theme header and...
php,mysql,codeigniter,associative-array
using CI I'm trying to set up query with three parameters: user_id, content_type and content_id in which content_id is array of IDs. So I need to get up with something like this: SELECT name FROM content WHERE user_id = 2 AND content_type = file AND (content_id = 4 OR content_id...
php,angularjs,codeigniter
I have being battling almost for day now about something that sound quite simple. I'm trying to pass an object using angular post ajax. I'm using PHP with codeigniter framework and I'm not getting any values pass. there have to be something wrong with the way I'm sending the object...
php,codeigniter
I have applied following code. But didn't find any solution. How I can add support gd library to server. public function addreqdoctor() { if($_FILES['userfile']['name']){ $ext = end(explode(".", $_FILES['userfile']['name'])); $new_name = time()."_".rand(1,10000).'.'.$ext; $basic['picture'] = $new_name; $config['upload_path'] = './doctors/'; $config['allowed_types'] = 'gif|jpg|png'; $config['file_name'] = $new_name; $this->load->library('upload', $config); if ( ! $this->upload->do_upload()) {...
php,jquery,codeigniter,jquery-ui-sortable
I am using jquery ui sortable for my codeigniter website but when i am sorting data it will give me empty array in console. please check and let me know my mistake. <script> $(document).ready( function() { $("#sortme tbody").sortable({ update : function (event, ui) { // console.log(ui); serial = $('#sortme tbody...
codeigniter,strobe-media-playback
I am trying to use the Strobe Media Playback plugin to play a video on my website. I am also using codeigniter framework for my site. The video that I am wanting to play is located in root>assets>videos>promo.mov. Below is what the object block looks like: <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="100%"...
php,codeigniter
This question already has an answer here: Array to sting conversion notice. Why? 1 answer I have an issue in my codeigniter script, I can't seem to figure out what the issue is, can anyone possibly help. $a = '<a href="' . $item['href'] . '" class="' . $aClass ....
php,codeigniter,seo
I'm using codeigniter framework. why Search Engine's not indexed my website images ? My website has been made since 2013. My website is : www.shadyab.com. It likes groupon website(Offering daily deals at restaurants, retailers and service providers.). An image url : http://www.shadyab.com/assests/images/upload/kaktoos4.jpg What should I do to tell search engines...
php,codeigniter,calendar
I am creating a calendar without jquery calendar plugin. I could retrieve the data which is in the database to the calendar. But when there are multiple data per day only one data comes to the calendar view. I want it to be like this when there is multiple data....
mysql,sql,codeigniter,activerecord
I have a query like this: SELECT RIGHT(id, 1) id_root FROM user WHERE LENGTH(id) = 3 and LEFT(id, 1) = '0' And how to convert that's query to active record in codeigniter. My problem is with syntax RIGHT( id, 1 ) and also at LEFT(id,1)='0'...
php,codeigniter
I have anchor in header.php as below: <a href="<?php base_url();>backend">Backend</a> Also have the controller named backend.php in Controllers folder. I also routed this code in routes.php file like $route('default_controller')='frontend'; $route('backend')='backend'; Backend controller page is: <?php class Backend extends CI_Controller { public function __construct(){ parent::__construct(); } public function index(){ $data['title'] =...
php,codeigniter
I'm newbie to codeigniter.I want to display the error message next to the text box.My view file create.php contains the following code. <?php echo validation_errors(); //validation echo form_open('news/create'); //create a form ?> <div class="boxes"> <div class="common"> <div class="lables"> <label for="name">Name</label> </div> <div class="text_boxes"> <input type="text" name="uname" /><div id="infoMessage"><?php echo $message;?></br>...
php,codeigniter,codeigniter-2,codeigniter-3
I have autoload helper form and library form-validation in autoload.php <?php defined('BASEPATH') OR exit('No direct script access allowed'); class Login extends CI_Controller { var $data; public function __construct(){ parent::__construct(); $this->data=array('page'=>'login_view','title'=>'login'); $this->load->model("Login_model"); } public function index() { //get the posted values $data=$this->data; $this->load->view('template',$data); } public function checklogin(){ //form validation $data=$this->data;...
mysql,codeigniter
I'm new to codeigniter. I having a problem checking two values in field using a model with codeigniter. I'm trying to check if "status" value is "Available" or "Notavailable" I'm using this model to check but only one value. 'Available' Only. public function withdraw_check($data) { $this->db->select('game'); $where = array('id_user' =>...
php,codeigniter,if-statement
I am using codeigniter framework for one of my inventory management systems. I prefer using php due to its variable functionality which makes things easier. So I am trying to get the username from session and then check the database for the level of the user and accordingly he should...
php,codeigniter
Why isn't the session variable value available on the second page load when I click the "Fake Login" link? class Fake_login extends CI_Controller { function __construct() { parent::__construct(); echo $this->session->userdata('session_id') . '<br>'; // First Page Load: ee3c7c5da6e465605cd57ad699aacdb3 // Second Page Load: c82adf312f123d56e3b7b6ab5ec6cafa echo $this->session->userdata('variable') . '<br>'; // First Page Load:...
php,codeigniter,pagination
In my News.phpcontroller,i'm having the below code: public function index() { $data['title'] = 'Database Details'; $config = array(); $config['base_url'] = base_url("news/index"); $config['total_rows'] = $this->news_model->record_count(); $config['per_page'] = 5; $config['uri_segment'] = 3; //$config['use_page_numbers'] = TRUE; // $config['page_query_string'] = TRUE; $choice = $config["total_rows"] / $config["per_page"]; $config["num_links"] = round($choice); $this->pagination->initialize($config); $page =...
php,codeigniter
Hi I need to get access to echo $Data->var_.... in my view. However, when I try to use echo I don't get data output. How can I fix it so that I get data in my view? I compressed a file with all three PHP pages here . Link *Controller...
php,codeigniter
I've created a view form_variables.php that contains all the form input variables defined in a single file. So that whenever i need to create an input field, i would simply include the form_variables file and then use the form input variables defined in the form_variables.php Here's what it contains. <?php...
php,jquery,codeigniter,tooltip
So I pretty much can't explain it in the title so don't downvote it because of that. Anyway.. I have template php files for dates and sharing. 1 file is like this: date-share.php <div class="date"><?php echo date('M d'); ?><span><?php echo date('Y'); ?></span></div> <a href="javascript:void(0);" class="share-button"><span class="plus"></span>Share</a> <!-- Tooltip --> <div...
php,codeigniter,cron,crontab,wget
I am pretty new to setting up cron jobs. What I've done so far is set one up to run every 5 minutes using the following script: */5 * * * * wget -q localhost:8888/example/index.php/controller/function When I run just the wget part from the command line, it works perfectly. But...
codeigniter
I want to create a demo account. How can I create an easy login controllers that does not require a database? This is my view. <div class="col-lg-12"> <label class="control-label"> Username / Email Address </label> </div> <div class="col-lg-12"> <input class="form-control" type="text" name="email_address" autofocus /> </div> <div class="col-lg-12"> <label class="control-label"> Password: </label>...
php,codeigniter,authentication
I want to deny user access when user is not logged in. So, what I did is put this code in every function of my controller: if((!$this->session->userdata('logged_in'))){ redirect(site_url()."/Login/logged_in",'refresh'); } And I also have this one: public function logged_in(){ $logged_in = $this->session->userdata('logged_in'); if(!isset($logged_in) || $logged_in !== true){ $this->load->view('ErrorAccess'); } } Then...
javascript,php,codeigniter
I'm using codeigniter and i have some issue with radio button, javascript, and php. The radio button is used for selecting type of customer. This is my radio button on view file <input type="radio" name="customerType" value="Reseller" /> Reseller <input type="radio" name="customerType" value="Dropshipper" /> Dropshipper <input type="text" class="form-control" value ="" name="customerCode"...
php,.htaccess,codeigniter
I redirected views/hello.php to this url path, without creating a subdir: www.domain.com/subdir/hello by using route.php $route['subdir/hello'] = 'pages/view/hello'; however, some of the pictures that's inside hello.php were gone. I checked the "images" folder but it's still there. I did check Inspect Element and there was an error: Resource interpreted as...
php,mysql,codeigniter,cookies
Actually i don't know what is this case name, i save/insert cart cookies php codeigniter to database, and it successful, but i cannot get the specific value from that database string. This is data from my DB a:1:{s:32:"1679091c5a880faf6fb5e6087eb1b2dc";a:6:{s:5:"rowid";s:32:"1679091c5a880faf6fb5e6087eb1b2dc";s:2:"id";s:1:"6";s:3:"qty";s:1:"1";s:5:"price";s:6:"275000";s:4:"name";s:10:"Vinly True";s:8:"subtotal";i:275000;}} And how can i get specific value in that string? for...
php,codeigniter
There's a way to add custom error messages to CodeIgniter validation_errors();? Example, if I wanted a field with a 123456 value, and the user inputs 12345 I'd want to set a message to say: The number 6 is required! And any other custom rules I may want to add. Like...
php,mysql,codeigniter
in my view i have one dropdown menu and one textbox..in my dropdown list contain 3 values daily salary,weekly salary and monthly salary..And the text field for amount.. in my db contain 3 columns for daily,weekly and monthly if i select a value in my dropdown then enter an amount...
php,mysql,database,codeigniter
I am using codeigniter and have a registration form that captures basic info such as email, username, and password. I will also have a Terms of use checkbox that will need to be checked in order to complete the registration. My question is should I be storing this in the...
php,codeigniter,validation,codeigniter-2,codeigniter-form-helper
Here's the situation: While building a project in CodeIgniter 2.2.0, I was attempting to validate a tabular form with a custom data validator. The tabular form was set up to transmit POST data to the server in standard array format, and I was using non-zero based numeric keys. My keys,...
php,codeigniter
I've deployed my source code in XAMPP. I'm getting following errors. Notice: Only variable references should be returned by reference in C:\xampp\htdocs\3c_app\public_html\system\core\Common.php on line 257 Fatal error: Class 'CI_Controller' not found in C:\xampp\htdocs\3c_app\public_html\system\core\CodeIgniter.php on line 233. My source files are: Common.php // Are any values being dynamically replaced? if (count($replace)...
codeigniter
Any time I try to access a page I created it says: Error Number: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3 SELECT * FROM (`_db_tb_article`) WHERE `article_id`...
php,codeigniter
When I click on search button the data is being sent, I have verified that but I keep getting this error as soon as I click the button now: A PHP Error was encountered Severity: Warning Message: Missing argument 1 for Admin::select() Filename: controllers/Admin.php Line Number: 52 Line number 52...
php,codeigniter,codeigniter-2,codeigniter-restserver
i have a chriskacerguis Rest Server ,that listen for a client request as usually an API Server do. base on client request i want to send/response some data to client in header only. my question are: how do i access Client header first? then how do i set Header in...
php,.htaccess,codeigniter,web-hosting
Hi community I have my PHP system using the 3.0 framework Codeigniter currently running on localhost so now my project went up to my hosting but do not work for me I get a 404 error. Detail the structure of my project: • Path where uploaded my project hosting .htaccess...
php,codeigniter,validation
I have three columns.The product of two columns get into third column name income_amount using codeigniter validation rule.the first column is crop_quantity and the second is per_rate controller $this->form_validation->set_rules('crop_quantity', 'Crop Quantity', 'required|numeric'); $this->form_validation->set_rules('per_rate', 'Per Rate', 'required|numeric|callback_get_product'); $this->form_validation->set_rules('income_amount', 'Income Amount', 'required|numeric');...
php,ajax,codeigniter,session
I have two page that are skytrip.localhost/searchresults and skytrip.localhost/bookingInfo In page searchresults , I make ajax request , then it is redirected to page bookingInfo. In ajax request , I set a sesion value , then I want to get this value in the page bookingInfo. But I can't get...
php,codeigniter,controller,autoloader
My situation is that, I have 20 controllers in my website, where I have a function like this. $this->lang->load("main", $this->session->userdata("lang_code")); How can I load this function in all the 20 controllers without adding it individually to the __constructor of every controller?...
php,codeigniter,azure
I've been trying to Setup Codeigniter 3 on the Windows Azure platform,everything seems fine for the normal setup but when i uploaded my application(Which i did via github so all the files are intact) and my session is set to autoload from config,i get the error "The resource you are...
php,ajax,codeigniter,codeigniter-hmvc
So this is the annoying kind of problem where something works perfectly on your local project, but everything breaks once deployed in production. In this case, i can access all the pages generated by a regular codeigniter controller (situated in application/controllers). However, once i try accessing a HMVC module, i...
php,codeigniter,model-view-controller
Please let me know How to echo textarea, Tried several versions but dint work. The whole page is in php. I am using codeigniter framework echo "<textarea name='openletter' id='openletter' style='width: 565px;' rows='8' cols='60'>"; <?php echo "$data['openletter']"; ?> </textarea>"; ...
jquery,ajax,codeigniter
All AJAX calls (I use jQuery) on page /index.php/contracts/add/new return full html of this page. But these calls on /index.php/contracts/ work fine. It seems like error is not in the PHP or JS code, but in the configuration. Here is my controller Contracts with two functions that I use for...
php,codeigniter
I have some trouble hidding the option tag using form_dropdown How to hide each j_status row == close, then the option tag could be hidden here's my script <?php $dev=''; foreach($j as $r) { if(($r->j_status)=='open') $dev='echo ""'; else if(($r->j_status)=='close') $dev='echo hidden'; } echo form_dropdown("id_j",$list_jid,"default",$dev,"id='some_id'"); ?> ...
php,css,codeigniter,fullcalendar
I want to create an event calendar. There are two halls in upstairs and downstairs. and functions should be categorized into am or pm. All together there are 4 different colors for upstairs am, upstairs pm, downstairs am and downstairs pm. I want to divided the calendar cell into four...
php,forms,codeigniter,validation
I am trying to write Form validation rules in my Controller to submit Change Password form in which I am checking the old password too. I am getting the old password(current) from db and placing it in a hidden input field. My Rules are simple and are given below $config=array(...
php,database,codeigniter,session
i am new to codeigniter and using session. i am having a problem in inserting individual data in session. Model: function get_user_info() { $user_email = $this->input->post('signin-email'); $this->db->select('acct_id, acct_fname, acct_lname, acct_mname'); $this->db->where('email', $user_email); $query = $this->db->get('account'); return $query->result_array(); } Controller: public function LoginValidation(){ $this->load->library('form_validation'); $this->form_validation->set_rules('email', 'Email',...
php,mysql,codeigniter
I have table like this: date_time value 2015-06-20 10:00:00 10 2015-06-20 9:00:00 6 2015-06-21 6:00:00 5 2015-06-22 11:00:00 12 2015-06-22 10:00:00 11 2015-06-23 4:00:00 20 I want to get the total value of each date Currently I have this on CodeIgniter but is not working: $this->db->group_by('date_time'); $query = $this->db->get('table_a'); Any...
php,codeigniter
I have a view page.i have to edit a list of values.bt after submit i have an error disallowed character key.I cant find it how this error occur. view foreach($track_details->result() as $name) { ?> <form class="form-horizontal" method="post" id="income_edit" action="<?php echo base_url();?>income_list_cntrl/update_income" enctype="multipart/form-data"> <input type="text" name="track_id" value="<?php echo $track_id; ?>" >...
php,mysql,codeigniter,php-5.3
I have those few lines of code: $array_to_filter // this array is unfiltered array_filter($array_to_filter, function($v){return array_filter($v) == array();}); $c = function($v){ return array_filter($v) != array(); }; $filtered_array = array_filter($airbnb, $c); print_r($filtered_array); // this is filtered array! Now I will be using this piece of code alot in my code and...
php,codeigniter,cron
I made research on site but couldn't find answer, so I decided yo ask this. I'm getting data via XML and this XML renews every 10 seconds. So, I have to re-run my Controller in every 10 seconds. I can not make it via Cron as you know it is...
php,function,codeigniter
I have below controller function of codeigniter, public function add_attachments($openid) { $config = array( 'upload_path' => './uploads/attachments/', 'allowed_types' => 'gif|jpg|png|jpeg|doc|pdf', 'max_size' => '1024000000', 'multi' => 'all' ); $this->load->library('upload', $config); if ( ! $this->upload->do_upload()) { $error = array('error' => $this->upload->display_errors()); } else { $data = $this->upload->data(); } $new_array = array_column ($data,...
php,arrays,json,codeigniter
Hi am having a little from with json array. when i try to get the values out of json array. Controller $data['payment'] = $this->admin->get_payment_settings(); $value = $data['payment'][0]->json; echo $value['username']; Hi am having a json array in database. using my controller i am getting the filed json. When i do a...
php,codeigniter
i created a news panel where we use this code for displaying news : <marquee direction="up" > <?php $query = $this->db->get('news'); foreach ($query->result() as $row) { echo $row->news; echo $row->urladdress; echo '<br/>'; } ?> </marquee> where it show correct , all data get fetched and run marquee good , but...
codeigniter,robots.txt
Where to place the robots.txt file in codeigniter. I dont no how to put where folder. User-agent: * Disallow: / ...
php,jquery,codeigniter
What is this syntax I've seen some documentations applying, for example: Jquery Sizzle Sizzle( String selector[, DOMNode context[, Array results]] ) Codeiginiter 3 set_userdata($data[, $value = NULL])...
php,codeigniter
I am trying to display data from database to the view but I am unable to do so. the problem I am having is that how do I display the data in a table tag while connecting it with the controller. View: <form action="#" class="login-wrapper" method="get"> <div class="span12" align="center"> <input...
angularjs,codeigniter,api,rest,token
I want to develop a web site with AngularJS. On the backend side I will use Codeigniter REST framework. I have some security issues and I don't want to start developing without fixing them on my mind. I don't want to use something like api key because it will be...
php,codeigniter,model-view-controller
I can't instantiate my models manually on my controller using require_once, following is the problem: Controller <?php require_once './application/models/portion/portioncreatormodel.php'; class Payment extends CI_Controller { function sample() { $pc = new PortionCreatorModel(); echo 'OK'; } } Model <?php class PortionCreatorModel extends CI_Model { function __construct() { parent::construct(); } } When I...
php,codeigniter
i am trying to create a readmore function in codeigniter where the readmore link will be linked to a controller which would show all the data about that particular id....i am kind of confused on how to go about it... i tried... <?php $research_detail_url = site_url()."/research/research_details"; //echo json_encode($research) if($research) {...
php,codeigniter,background
Is it possible to execute a php function according to a timely manner in a web server ? Ex - execute a function every day at 4.30 PM.
codeigniter,multidimensional-array
On my codeigniter project my callback is not working as would like with my multidimensional array post I am trying on my callback set message $key['image'] to display correct value of the multidimensional array post. But when I var dump it returns NULL On my set rules the multidimensional array...
php,codeigniter,url
I have a code igniter site which I have enabled some special characters so that characters such as £ can be used in the URL: EG: http://mysite.co.uk/products/details/Product-name-£ When I click on the URL, it tries to take me to the product page and then redirects me back to the homepage....
php,mysql,codeigniter
In a CodeIgniter model class, given a query that returns unknown table columns, $sql = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'myDatabase' AND TABLE_NAME = 'assets';"; return $this->db->query($sql)->result(); And where the CodeIgniter docs give the example of looping over a query result with known object properties: foreach ($query->result() as...
php,mysql,codeigniter
I'm click my submit button freely without enter values in the form..then in my database a row inserted that columns contain zeros controller function submit_expense() { $exp_date=$this->input->post('expense_date'); $expense_ids= $this->input->post('expense'); $expense_ids=substr($expense_ids,0,strlen($expense_ids)-1); $expense_id_array = explode(',',$expense_ids); $id=$this->session->userdata('userid'); for($i=0;$i<count($expense_id_array);$i++) { $required_id = TRIM($expense_id_array[$i]);...
mysql,.htaccess,codeigniter
Actually I'm trying to configure my codeigniter live file to localhost. I have, created a database called test_bs then imported the tables Then change the base_url like $config['base_url']=http://localhost/gu_ci/'; and $config['index_page']='index.php'; in config.php And then did a change on database.php,Which contains $active_group = 'default'; $active_record = TRUE; $db['default']['hostname'] = 'localhost'; $db['default']['username']...
php,performance,codeigniter
In creating a log in process in CodeIgniter I have this for the __construct. public function __construct() { parent::__construct(); $this->load->library('session'); $this->load->helper('form'); $this->load->helper('url'); $this->load->helper('html'); $this->load->database(); $this->load->library('form_validation'); $this->load->model('login_model'); } The index method contains all the necessary code to handle the login. I am going to set up the log out process and...
php,mysql,codeigniter,model-view-controller
I am implementing a voting system in codeigniter: The problem is that everytime a user clicks on upvote $this->db->set('up', 'up+1', FALSE); is executed and up is incremented by one. But it should only increment if count == 0. My Model code is : public function up_votes($id,$ip) { $query = $this->db->query("SELECT...
php,codeigniter
I want to show response in json format in controller and don't want to move in view. So, please let me any way so that I can show json response. Here is the code where i want to add json headers. $result = $this->mod_doc->get_list(); echo json_encode($result); ...
php,mysql,codeigniter
I store multi level category. The table look like this: Categories Table +-------------+---------------+--------------------+ | category_id | category_name | parent_category_id | +-------------+---------------+--------------------+ | 1 | Clothing | NULL | | 2 | Footwear | NULL | | 3 | Men | 1 | | 4 | Women | 1 | |...
php,json,codeigniter
When I run this function, I'm getting Message: array_push() expects parameter 1 to be array, null given in line number 676 Severity: Warning Message: array_push() expects parameter 1 to be array, null given Filename: controllers/main.php Line Number: 676 function get_order_details() { $query1="SELECT * FROM order_main "; $o_main=$this->main_model->query_return($query1); $query="SELECT * FROM...
mysql,oracle,codeigniter
I'm using Mysql and Oracle for my CI application. I tried to connect it but I found that I cannot make a query to Oracle database. It always gave an error that the table is not exist. I already set the database.php to something like this $active_group = 'oracle'; $active_record...
php,codeigniter,coordinates,kml,geojson
I am currently grabbing the KML used to define the polygons seen here. I am using the algorithm detailed in this answer to determine if the point is inside the polygon. The problem I have though is if the point is inside an empty part of the polygon, as seen...
javascript,php,codeigniter,radio-button
I want to insert selected radio button value into the database. just "yes" or "no". if anyone can give me an idea it would be a great help. I am using codeigniter framework. Thanks in advance. Model function add_reservation($reservation_model) { return $this->db->insert('reservations', $reservation_model); } Controller function add_reservation() { $reservation_model =...
codeigniter
On my Codeigniter Custom helper I would like to be able to pass data through my load_controller function $params But I cannot pass any data through load_controller('controller', 'function', $setting); Custom Helper <?php if (!function_exists('load_controller')) { function load_controller($controller, $method = 'index', $params = '') { require_once(APPPATH . 'controllers/' . $controller ....
php,mysql,codeigniter
My line number 35 of view/blog/index.php is as: <a href="<?php echo base_url().'post/'.$post->entry_id.'#comments';?>" class="comments">Comments (<?php echo $post->comment_count;?>)</a> I have made a column in table comment as comment_id still its not working and in my model/blog_model.php it is a function as: $count = array( 'comment_count' => $total_count, ); Thanks in advance...
php,.htaccess,codeigniter
I am using Codeigniter framework in PHP. My website is on apache server. Path: /var/www/example.com/public_html .htaccess RewriteEngine on RewriteCond $1 !^(index\.php|public|\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?$1 But still I am getting this error on accessing this page: www.example.com/test/wallet: The requested URL /test/wallet was not found on...
php,.htaccess,codeigniter,tankauth
I have answered this question previously and even posted the answer to it by myself. I tried most of the answered questions, but it still didn't work. The first question is regarding placement of the .htaccess file, should I keep it with application folder or inside it? and the next...
php,mysql,codeigniter
I'm running this in CI, and $query->result_array() is returning null values, however, when I use $this->db->last_query(), and print out the query, then run it in a MySQL client (Sequel Pro), I get values back as I would expect. What would cause this to return NULL when doing it through CI?...
php,codeigniter,codeigniter-2
In the model (model_users) I have the following : public function members_list() { $query = $this->db->get('USERS'); return $query->result(); } In the controler I have the following function: public function members_list() { $this->load->view('members_list_view'); } In the view file I have the following code: $this->load->model('model_users'); $membersArray = $this->model_users->members_list(); foreach ($membersArray as $v1)...
codeigniter,foreach
I have in my view 4 selects with the same name - wrappingType[]. They are for 4 different sizes. I tried but I couldn't make update cycle to update data in database. I want when user selects from these 4 selects - these values to be updated in database in...
php,apache,.htaccess,codeigniter,mod-rewrite
I am working on a project in which url Rewriting was done. Here is the link of the old uri http://www.mysite.pk/jobs/search/faisalabad/all-cats But now in the new url I have changed it to http://www.mysite.pk/jobs/pakistan/faisalabad/all-cats what I want to do is to change the redirect all the url's whcih have http://www.mysite.pk/jobs/search/ search...
codeigniter
On my helper function if controller is in parent directory I can load controllers from subfolders load_controller('subfolder/class'); Problem If I have a controller that is in a subfolder and want to use this load_controller('subfolder/class'); I cannot pick it up other controllers if I call them from a controller that is...
php,mysql,codeigniter
i am trying to insert multiple check box data in one time in rest api web service. But i can insert only one data. This is my controller method public function insert_code_post(){ $user_id = $this->input->post('user_id'); $code_id = $this->input->post('code_id'); $records = array(); for($i=0; $i < count($code_id); $i++){ $records[] = array('user_id' =>...
php,mysql,codeigniter
I have an sql select query with where. If I put a static value, it works fine. But if I use a parameter value like $name, it doesn't work. Here's my sample code: I'm using codeigniter, this query written in model. working query: (It returns a correct value) function getid($email){...
php,mysql,codeigniter,join,codeigniter-3
I'm having some trouble figuring out how to write the proper query after doing a JOIN. I need to get all users in Group 1 while excluding a subset of these results. Table users: id name 1 John Smith 2 Joe Blow 3 Mary Jane Table users_groups: user_id group_id 1...
jquery,codeigniter
I'm trying to pass an array to my CI controller using the jquery .load() function but I'm getting this error: A PHP Error was encountered Severity: Warning Message: Missing argument 1 for QuestionQueue::update() Filename: controllers/QuestionQueue.php Line Number: 27 Backtrace: File: D:\software\wamp\www\Quiz\application\controllers\QuestionQueue.php Line: 27 Function: _error_handler File: D:\software\wamp\www\Quiz\index.php Line: 292 Function:...
php,codeigniter,session,session-state
This might be a silly question. Once a user has been logged in, if session expires I want to redirect him to a "lockscreen" instead to a "login" page. I want to send to the lockscreen some session data (like img-src and loginname) So, here's the question. Does session object...
php,codeigniter,phpunit,guzzle
I am writing a unit test for an API that I am developing. The API is written in the Codeigniter framework, that calls another API using Guzzle. The test I am writing verifies that the API call returns the correct response. The Test.php file contains the following code require '/application/libraries/apiWrappers/Breathehr.php';...
php,mysql,json,codeigniter
I'm very new to php, mySql and CodeIgniter. I'm trying to read from mySql file and write the data read to a JSON file using CodeIgniter. I can read the data from mySql and view it and can create JSON file but have gotten totally bogged down with all the...
php,codeigniter
The index.php file line no. 23 is as: echo ucfirst($author->username); My blog_model.php file in controller folder is as: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Blog_model extends CI_Model { function get_posts() { $this->db->order_by('entry_date','desc'); // get all entry, sort by latest to oldest $query = $this->db->get('entry'); return...
codeigniter,production-environment
I have problem that cannot load any css, js, images, etc in production server. Error resource: the server responded with a status of 404 (Not Found) This is the my folder tree public_html/ application/ assets/ ... I'm using base_url() when try to load any file in assets directory, example: <link...
php,arrays,codeigniter,foreach
I want to use array in foreach loop but failed, here is my code: foreach($this->db->get_where('mytable', array('result' => '1 or 2', 'id' => 'foo'))->result_array() I think 'result' => '1 or 2'piece has a problem but I couldn't find out how can I use array in this kind of foreach. I want...
php,codeigniter,cart
This project is with E-Commerce. There is option to Add to Cart. When user click on add, product will be added to his cart as well and working fine. But finally when user click place order button Admin will receive Mail with products. That E-mail body should content should display...
codeigniter,join,condition
I have 2 tables - for orders and for documents for these orders. I want to show all orders from first table and if there are documents for these orders, to show date of documents(I take date from table documents). I'm trying to make 2 join conditions because in table...
php,codeigniter
A user sees a coupon page, enters the coupon code and if the coupon is valid, they see a page to pick their gift (known as exploits). (Part 1) They can choose any exploit. And after they choose it, it saves it in database after clicking submit. But it only...
json,codeigniter,select,insert,routing
I have very simple users database: user_id, user_name, user_email My model this: class Users extends CI_Model { private $table; private $table_fields; private $table_fields_join; function __construct() { parent::__construct(); $this->table = 'users'; $this->table_fields = array( $this->table.'.user_id', $this->table.'.user_name', $this->table.'.user_email' ); $this->table_fields_join = array(); } function select(){ $this->db->select(implode(', ', array_merge($this->table_fields, $this->table_fields_join)));...
php,codeigniter
how call .php outside the folder my folder structurer is I'm in cart.php my code is $tpl_file ='../mail.php';//problem is here LINE 279 $msg_tmpl = file_get_contents($tpl_file); if (!file_exists($tpl_file)) { ?> <script> alert('no'); </script> <?php } else { ?> <script> alert('yes'); </script> <?php } So my question is I want to get...
php,html,arrays,codeigniter
I want to fetch a table which has 2 columns: id and name, and I want column id as value for each option, and column name as option name This is my controller //populate provinsi $this->load->model('Provinsi'); $provinsi = $this->Provinsi->get(); $this->load->view('admin/pages/product_form', array( 'provinces' => $provinsi, )); And in my view <?php...
javascript,php,jquery,ajax,codeigniter
Here is my code. <form id='user'> <label for="name">Name :</label> <input type="text" id="name" name="name"/> <label for="email">Email :</label> <input type="text" id="email" name="email"/> <input type="submit"/> </form> <div id="output"></div> jQuery: $('#user').on('submit',function(event){ event.preventDefault(); var data=$(this).serialize(); adddetails(data); }); function adddetails(data){ var url='http://localhost/projectname/index.php/users/adddat';...