Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 10,135
» Latest member: shf
» Forum threads: 67,041
» Forum posts: 419,783

Full Statistics

Latest Threads
Add key to header in all ...
Forum: General Help
28 minutes ago
» Replies: 1   » Views: 65
CI do not have model to m...
Forum: CodeIgniter 4 Feature Requests
1 hour ago
» Replies: 1   » Views: 62
Case Sensitive Filenames ...
Forum: CodeIgniter 4 Feature Requests
1 hour ago
» Replies: 6   » Views: 215
Session issue
Forum: Issues
3 hours ago
» Replies: 0   » Views: 20
[sysadmin] requirements t...
Forum: General Help
4 hours ago
» Replies: 4   » Views: 214
Fetch and Update Data in ...
Forum: General Help
7 hours ago
» Replies: 1   » Views: 89
Help!! I am new at this.
Forum: Installation & Setup
7 hours ago
» Replies: 4   » Views: 125
ion_auth's 1.2mb memory u...
Forum: Addins
7 hours ago
» Replies: 2   » Views: 102
still losing session user...
Forum: General Help
7 hours ago
» Replies: 27   » Views: 927
user_agent Chrome as Oper...
Forum: CodeIgniter 3.x
8 hours ago
» Replies: 2   » Views: 164

 
  Codeigniter Join query
Posted by: akgarg007 - 12-10-2017, 08:52 AM - Forum: General Help - Replies (3)

CODEIGNITER + MySQL DB
Hi I have two tables

Table 1

<pre><code>
CREATE TABLE `users` (
  `user_id` int(255) NOT NULL,
  `user_name` varchar(100) NOT NULL,
  `user_email` varchar(100) NOT NULL,
  `user_password` varchar(200) NOT NULL,
  `user_phone` varchar(20) NOT NULL,
  `building_units` int(200) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `status` enum('0','1') NOT NULL DEFAULT '1' COMMENT '1 = Active(default), 0 = Inactive',
  `user_role` enum('0','1','2','3') NOT NULL DEFAULT '2' COMMENT '0=Manager,1=Admin,2=User,3=Tenant',
  `user_ip` int(39) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Table 2
<pre><code>
CREATE TABLE `building_admins_tbl` (
  `id` int(255) NOT NULL,
  `building_id` int(255) NOT NULL COMMENT 'FK ',
  `building_admin_id` int(255) DEFAULT NULL COMMENT 'FK',
  `user_id` int(255) DEFAULT NULL,
  `tenant_id` int(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

And I have written the following query.
<pre><code>
$select = 'users.user_id,users.user_name,users.user_role,users.status,building_admins_tbl.building_admin_id';
$join_str = 'users.user_id != building_admins_tbl.building_admin_id';
$where = ['users.user_role'=>'1','users.status'=>'1'];
        
        $q =$this->db    
                    ->select($select)
                    ->where($where)
                    ->from('users')    
                    ->join('building_admins_tbl',$join_str)
                    ->get();
        $admin_list =$q->result_array();

In the above query, Join string is important, I want to get only those rows where(users.user_id != building_admins_tbl.building_admin_id) with where condition as well. 

But I am not getting the expecting result, Please help me whats wrong in the query. Help appreciated.

Thanks


  Php Syntax not working on this line
Posted by: Redwoodcutter - 12-10-2017, 05:22 AM - Forum: General Help - Replies (3)

So I'm new here i now that because of this basic problem, once hi everyone and thats my problem in php framework in codeigniter.
I'm using Netbeans ide and wamp server.

this is my controller codes I'm have a database like Id Picture Profile and more. so i put in data in database and i want to uptade my Picture coloumn like this.

PHP Code:
public function Picture_Upload($id){
 
       
             $data
["$id"]=$id;
 
            $this->load->view('admin\add_products_picture',$data);
    }
 
        public function Save_picture($id){
 
               $data["$id"]=$id;
 
                
                $config
['upload_path'         './upload/';
 
               $config['allowed_types'       'gif|jpg|png';
 
               $config['max_size'            100;
 
               $config['max_width'           1024;
 
               $config['max_height'          768;

 
               $this->load->library('upload'$config);

 
               if ( ! $this->upload->do_upload('Picture'))
 
               {
 
                       
                        $error 
$this->upload->display_errors();
 
                       $this->session->set_flashdata("msj","Someting goes wrong try again".$error);
 
                       $this->load->view('admin/add_product_picture',$data);
 
               }
 
               else
                
{
 
                       $upload_data $this->upload->data();
 
                       $data=array(
 
                         'Picture'=>$upload_data["file_name" 
                        
);
 
                       $this->load->model('Database_Model');
 
                       $this->Database_Model->update_data("Products",$data,$id);
 
                     
                        redirect
(base_url().'admin/Products');
 
               }
 
       
            
    
}
    


           

here is my Database_model

PHP Code:
  public function update_data($tablo,$data,$id){
 
               $this->db->where('id',$id);
 
               $this->db->update($tablo,$data);
 
               return true;
 
           


and this is the form of all of this.

PHP Code:
<?php
$this
->load->view('admin\_header');
 
   
?>

<div id="page-wrapper">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-4">
                       
                        <h1 class="page-header">Add</h1>
                        <?php if($this->session->flashdata("msj")) { ?>
                         <div class="alert alert-info">
                             <a href="#" class="alert-danger">Sometings Go Wrong</a>
                             <br>
                                <?=$this->session->flashdata("mesaj");?> 
                                
                            </div>
                        <?php ?>
                        <form  method="POST" enctype="multipart/form-data" action="<?=base_url()?>admin/product/Save_Picture/<?=$id?>" >
                            <div class="form-group">
                            <label for="exampleInputEmail1">Save Picture</label>
                            <input type="file" class="form-control" id="pic" required name="pic"  >
                          </div>
                          <button type="submit" class="btn btn-primary">Send</button>
                        </form>
                    <!-- /.col-lg-12 -->
                </div>
                <!-- /.row -->
            </div>
            <!-- /.container-fluid -->
        </div>
</div>
<?php
$this
->load->view('admin\_footer');
?>


this is all to my codes so now i cant get to id like this 
action="<?=base_url()?>admin/product/Save_Picture/<?=$id?>"
browser give me error like that : 
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: id

Filename: admin/add_product_picture.php

Line Number: 20

and i can not get it to image id so i cant uptade to data base but the picture comes from to uploads file so database not updating. there are still empty. when i was write to <?php $id ?> there is a no error around but so still i cant get to id and name of image in database.

if you know and tell me i will thanks a lot for this. thanks for helping or trying to this if you want i can share my code in github.

i'm student of computer engineering in Turkey, and sorry for my Bad English.


  How can I remove all http-headers
Posted by: temi - 12-10-2017, 04:53 AM - Forum: General Help - Replies (1)

Hi all,
I just want to remove all headers that php will add
no Set-Cookie, Pragma, Cache-Control. Because this headers prevent my cache (nginx fastcgi cache) from caching. I know I can use fastcgi_ignore_headers but I think it's better php controls the cache.

Thank you
temi


  How make "no expires" for redis
Posted by: rolly - 12-09-2017, 10:56 AM - Forum: Installation & Setup - Replies (1)

I know what default ttl 60 sec, but how I can set "no expires" for my data? 
Have a recipe?


  Is REST API Possible with Codeigniter?
Posted by: mahesh2150 - 12-09-2017, 04:32 AM - Forum: General Help - Replies (8)

I want to create REST API. I have chosen two framework to work with. One is Slim and another one is Lumen. But if it is possible with codeigniter i will stick with codeigniter.


  Url Helper Function site_url()
Posted by: Stef - 12-09-2017, 04:09 AM - Forum: Libraries & Helpers - Replies (2)

Hey,

i have start now to learning this framework. I using in this time the url_helper with the function site_url().
I have in my config.php the base_url looking like this :  $config['base_url'] = 'localhost/htdocs/php/frameworks/codeigniter/';

Now if i using the site_url()-function the full url will be created, but if i pressing the link this base_url append to the other url in the url_bar in the browser. So my url is like this:  http://localhost/php/frameworks/codeigniter/index.php/news/localhost/htdocs/php/frameworks/codeigniter/news/

I have tried to delete the bas_url content. But if i do it, i get, if i pressed the url like this: [:019:]/php/frameworks/codeigniter/index.php/news

How i can solve this problem?


  No input file specified. Godaddy
Posted by: RMaynard - 12-08-2017, 11:46 AM - Forum: Installation & Setup - Replies (5)

Help! After days and trying every combination of .htaccess and config.php I could find, I still have "No input file specified".



CodeIgniter will bring up the welcome screen as long as I don't try to call a controller, but fails on any one I try.

such as; http://mysite.org/CodeIgniter/index.php/main or http://mysite.org/CodeIgniter/main with .htaccess 



Site is Godaddy shared Economy Linux hosting (Yes I wish it was a different host)

with Wordpress and Wordfence installed in the root.



CodeIgniter is installed in: /CodeIgniter

PHP Version 5.6.27



The problem seems to be the way Godaddy handles paths, but I'm not smart enough to figure it out.

These entries are in the error log:

DEBUG - 2017-12-08 10:20:59 --> No URI present. Default controller set.

INFO - 2017-12-08 10:20:59 --> File loaded: /home/content/50/8634350/html/CodeIgniter/application/views/welcome_message.php



Here are some server varibles, both ran from directory /test:

Working site:

_SERVER['DOCUMENT_ROOT']: /home1/raymayna/public_html

_SERVER['SUBDOMAIN_DOCUMENT_ROOT']: 

_SERVER['HTTP_HOST']: mysite.com

_SERVER['SERVER_NAME']: mysite.com

Current Path: /home1/raymayna/public_html/test



Non working Godaddy site:

_SERVER['DOCUMENT_ROOT']: /var/chroot/home/content/50/8634350/html

_SERVER['SUBDOMAIN_DOCUMENT_ROOT']: /var/chroot/home/content/50/8634350/html

_SERVER['HTTP_HOST']: mysite.org

_SERVER['SERVER_NAME']: mysite.org

Current Path: /home/content/50/8634350/html/test



Note the differences in DOCUMENT_ROOT and Current path on the Godaddy site.



Here is my CodeIgniter configuration:

config.php

$config['base_url'] = 'http://mysite.org/CodeIgniter/';

$config['uri_protocol'] = 'REQUEST_URI';

Also tried,

$config['uri_protocol'] = 'QUERY_STRING';





$config['index_page'] = 'index.php';

with no .htaccess in /CodeIgniter



Also tried,

$config['index_page'] = '';

with the following .htaccess in /CodeIgniter;

.htaccess

RewriteEngine On

RewriteCond %{REQUEST_URI} ^/system.*

RewriteRule ^(.*)$ index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.+)$ index.php?/$1 [L]



I am wondering if Wordfence is my problem, as there is this in the PHP configuration:

auto_prepend_file  /home/content/50/8634350/html/wordfence-waf.php



And this in /user.ini

; Wordfence WAF

auto_prepend_file = '/home/content/50/8634350/html/wordfence-waf.php'

; END Wordfence WAF



The root also has an .htaccess with the following, which is the way I inherited this can of worms;

RewriteEngine on

RewriteRule ^6052317648/(.*)$ inconvertible-exclaiming.php [QSA,L]



RewriteEngine On



RewriteCond %{ENV:REDIRECT_STATUS} 200

RewriteRule ^ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{HTTP_USER_AGENT} (google|yahoo|msn|aol|bing) [OR]

RewriteCond %{HTTP_REFERER} (google|yahoo|msn|aol|bing)

RewriteRule ^(.*)$ ironwood-insure.php?$1 [L]



# BEGIN WordPress

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

</IfModule>



# END WordPress





# Wordfence WAF

<Files ".user.ini">

<IfModule mod_authz_core.c>

Require all denied

</IfModule>

<IfModule !mod_authz_core.c>

Order deny,allow

Deny from all

</IfModule>

</Files>



# END Wordfence WAF





Also I was testing to see if mod_rewrite was working and found that this doesn't work on the Godaddy site, but does on working site.

RewriteRule ^link([^/]*).html$ rewrite.php?link=$1 [L]

If I explicitly set the base like this it works on Godaddy. 

RewriteBase /test/

RewriteRule ^link([^/]*).html$ rewrite.php?link=$1 [L]



I don't need to get rid of needing index.php, as this is for a backend application, I just need it to work.
Has anyone gotten CodeIgniter to work on a similar configuration?


  Query Builder Class
Posted by: tim888 - 12-08-2017, 05:07 AM - Forum: Libraries & Helpers - Replies (1)

Can someone please explain the following code related to the query builder class?
$this->db->select('(SELECT SUM(payments.amount) FROM payments WHERE payments.invoice_id=4) AS amount_paid', FALSE);

$query = $this->db->get('mytable');


  How i can executed my controller in the url
Posted by: Stef - 12-08-2017, 04:55 AM - Forum: Installation & Setup - Replies (2)

Hey,

i have choosing today the way to coding with CodeIgniter. So i'm a newbie in frameworks, but the framework looks not so hard. I have tried the first Tutorial "static page". Now if i want to call the site in the url i get everytime the error, that this site doesn't exist. I don't know why this is. 

A url looks after the tutorialsite so : /[controller-method]/[arguments]http://example.com/[controller-class]/[controller-method]/[arguments]

I executed all at xampp local. And if i executed it like this i get everytime the error.

My Path to the framework folder is this :http://localhost/php/frameworks/codeigniter/
Now if i want to executing my controller with the method the url must be like this: http://localhost/php/frameworks/codeigniter/pages/view

But if i load this url i get everytime the error, that this object can't get found.

The Code is:


PHP Code:
<?php

class Pages extends CI_Controller{

    public function 
view($page 'header'){

        
// APPPATH = application folder

        
if(!file_exists(APPPATH "views/templates/" $page ".php")){
            
show_404(); // ->shows 404 error site
        
}

        
$data = [];

        
$data["title"] = ucfirst($page); // ucfirst sorgt dafür das der erste buchstabe ein Großbuchstabe ist


        //seite laden/aufrufen
        
$this->load->view("pages/header/"$data);
        
$this->load->view("pages/footer/"$data);

    }



My 2 view-datas looks so:

header.php
PHP Code:
<!DOCTYPE html>
    <
html>
        <
head>
            <
title><? echo $title?></title>
        </head>
        <body>
            <p>Titel dieser Seite lautet <? echo $title?></p> 

footer.php
PHP Code:
        <p>copyright @stef</p>

    </
body>
</
html

Hope you can help me.

Stef


  creat store procedure in codeigniter with sql server
Posted by: Nino Bagus - 12-08-2017, 04:07 AM - Forum: General Help - No Replies

A Database Error Occurred
Error Number: 42000/102
[Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Incorrect syntax near ')'.
exec tampil_penerbit()
Filename: C:/xampp/htdocs/stored_procedure_ci/system/database/DB_driver.php
Line Number: 691



Attached Files Thumbnail(s)
   


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.