Welcome Guest, Not a member yet? Register   Sign In
  Default URL behaviour
Posted by: El Forum - 08-08-2007, 06:34 AM - No Replies

[eluser]bikuta[/eluser]
I read from the documentation that the default behaviour for URL is something like:
www.your-site.com/index.php/news

However this doesn't work instead I have to use this:
www.your-site.com/index.php?news

Anyone know what could be the reason for this?


  Problem with database connection - Cannot make MySQL server connection.
Posted by: El Forum - 08-08-2007, 05:38 AM - No Replies

[eluser]FuriKuri[/eluser]
Hi all.

I have been developing an app into a localhost server (xampp lite version, for more details) and everything was fine, but once i decided to move into a subfolder of a OVH hosting i started having problems with the database connetion.

My default_controller (login) can connect to the mySQL and querys go well, but the problem start when this controller redirects to the next page, at this point all the controllers cannot connect to the mysql database, and if they try to do that the next error appears:

Error!
Cannot make MySQL server connection.


I'm a noob with Codeignitor, so plz be patient with me. If u need more information plz ask.

PS: Sorry for my english. Smile


  Session Class - Add, Edit and Remove
Posted by: El Forum - 08-08-2007, 02:21 AM - No Replies

[eluser]webdude[/eluser]
Are you able to update and remove items in a session using the Session Class?

I am building a quoting system which acts like a "shopping cart" where the user adds products on which they want a quote on and will require them to be able to add new items, remove existing or update existing items.

Thanks in advanced.


  $this->db->affected_rows() doesnt return no. rows deleted???
Posted by: El Forum - 08-07-2007, 10:59 PM - No Replies

[eluser]the real rlee[/eluser]
Hi guys, i was reading the user guide and supposedly an inbuilt hack in the Active Record class for mysql should make $this->db->affected_rows() return the actual rows deleted...But i cant seem to get it to do so. My sql definitely deletes the record

Code:
$this->db->delete('gallery_photo', array('gallery_photo_id' => (int)$gallery_photo_id));
        $affected_rows = $this->db->affected_rows();
        if ($affected_rows == 0) {
            show_error('Gallery Model: Invalid photo ID ('.$gallery_photo_id.') unable to delete photo (affected rows: '.$this->db->affected_rows().')');
            log_message('error', 'Gallery Model: Invalid photo ID ('.$gallery_photo_id.') unable to delete photo.');
        }

Am i missing something?


  Dynamic autoload.php (how to get values from database?)
Posted by: El Forum - 08-07-2007, 10:33 PM - No Replies

[eluser]koniciwa[/eluser]
Facing a situation now where I need to allow users to customize the loaded libraries from autoload. These values are stored in the database. The problem is that the database is only loaded after processing the autoload.php file and not before, leaving me with mysql_query() to do the task of retrieving from database. I'm just wondering if there's a better way to do this?

Thanks


  Applying Inheritance
Posted by: El Forum - 08-07-2007, 07:09 PM - No Replies

[eluser]Unknown[/eluser]
Dear fellow CI developer,
I'm in the process of developing a CMS (content management system) application. and typically CMS will have "users" that can login to edit the content of their article/post/message. I'm adding an "admin" control which also need to login, but they will be able to edit/approve user's article.

so my practice on this is to create 2 tables "admin" and "user" and two model "admin_model.php" and "user_model.php".
in the process of doing this I started to realize that they both share very similar behaviour. So I was thinking to apply the inheritance approach for this.
Since user is more basic and broad, I put user as the parent and admin as the child.

here is my two model code.

Code:
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class User_model extends model
{  
    var $table_name;
        // -- Constructor -----------------------------------------------  
    public function __construct()  
    {    
        parent::Model();
        $this->table_name = "user";
    }

    public function get_user($id)  
    {        
        $query = $this->db->query("SELECT * FROM $this->table_name
                                           WHERE id = '$id'");
        $row = $query->row();
        return $row;
    }
}
?>

Code:
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
require_once('user_model.php');

class admin_model extends User_model
{
    var $table_name;
    // -- Constructor -----------------------------------------------  
    public function __construct()  
    {    
        parent::__construct();
        $this->table_name = "admin";
    }
}

and in my controller I just load them by using "$this->load->model('Admin_model');"
I just wondering if my structure, the way I extends the parent, the way I assign my $table_name value is correct? should I declare the table_name value inside the constructor or outside? I still have to call the parent's constructor right? eventhough I don't want to use its "$table_name".
Also I don't have to write my function get_user($id) in my admin_model right? since I can just use the parent's function?

Thank you =)


  Is there a simple way to just add the login form to any of my pages using freakauth?
Posted by: El Forum - 08-07-2007, 06:02 PM - No Replies

[eluser]ceej[/eluser]
Hi there,

Is there a simple way to just add the login form to any of my pages using freakauth without it ad all the freakauth templates etc.......?

Many thanks


  Problem with views
Posted by: El Forum - 08-07-2007, 03:59 PM - No Replies

[eluser]proximo[/eluser]
I wanna try to do something like this:

Code:
<?php

class Welcome extends Controller {

    function __constructor()
    {
        parent::Controller();    
        
        $this->load->view('header', array());
    }
    
    function index()
    {
        $this->load->view('content',array());
    }
    
    function __destructor()
        {
        
        $this->load->view('footer',array());
    
    }
}
?>
But I have problem becouse there are no __destructor (white page) and this idea doesn't work :/. Someone has idea how to make this?


  remove index.php from form_open()
Posted by: El Forum - 08-07-2007, 03:58 PM - No Replies

[eluser]webdude[/eluser]
is it possible to remove the index.php when using form_open() ?

Code:
echo form_open('email/send');
The above example would create
Code:
<form method="post" action="http:/www.your-site.com/index.php/email/send" />


  [question - solved] Join - active record
Posted by: El Forum - 08-07-2007, 03:16 PM - No Replies

[eluser]wemago[/eluser]
oks i couldnt find any awnser for this in the forum.

Code:
$this->db->select('username');
        $this->db->from('users');
        $this->db->join('articles', 'articles.author_id = users.user_id');
        
        return $this->db->get();

I'm trying to get a username and all i get is this ->
Quote:Object id #19

any idea why?it should give me the name.

thanx


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

Username
  

Password
  





Latest Threads
curl + response body
by okatse
3 hours ago
tool bar not showing
by Luiz Marin
7 hours ago
Tool bar not showing
by Luiz Marin
7 hours ago
AbuseIPDB Module
by InsiteFX
9 hours ago
Heads up for users using ...
by davis.lasis
Yesterday, 12:54 PM
The Hidden Cost of “Innov...
by fcoder
Yesterday, 03:11 AM
Validation does not appea...
by grimpirate
07-01-2025, 01:55 PM
Block IP addresses of bad...
by grimpirate
07-01-2025, 01:47 PM
Override Router
by grimpirate
07-01-2025, 01:30 PM
CodeIgniter.com - Report ...
by Vikas Mehta
06-30-2025, 10:30 AM

Forum Statistics
» Members: 154,548
» Latest member: tylekeonhacaitop
» Forum threads: 78,437
» Forum posts: 379,719

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB