Welcome Guest, Not a member yet? Register   Sign In
  Issue, in the file system\database\DB_utility.php
Posted by: El Forum - 10-31-2008, 09:48 PM - Replies (4)

[eluser]Prasanna[/eluser]
I have noticed a issue, in the file system\database\DB_utility.php

The line @ line number 178 is like the following:

Code:
if ( ! is_object($query) OR ! method_exists($query, 'field_names'))

And i think it should be

Code:
if ( ! is_object($query) OR ! method_exists($query, 'list_fields'))

as the "field_names" method is DEPRECATED.


  Database access before controllers / configs load
Posted by: El Forum - 10-31-2008, 07:21 PM - Replies (2)

[eluser]haraldo[/eluser]
Hi there,

I have a pre-controller hook that instantiates a custom session library class. Once instantiated i want to log some data. Problem is the database library doesn't exist yet. So how can i access the database at this stage. If i don't log stuff here ( in my session class ) and put the log method in a controller it logs every time the controller class is instantiated. That's not good for me.

Thanks for any advice.


  Best way to add/edit a listing
Posted by: El Forum - 10-31-2008, 06:06 PM - Replies (11)

[eluser]CIfan1000[/eluser]
Hi,

I've been trying to figure out how to do this for a few days, and any help would be much appreicated:

I would like to have a single controller that can add or edit a user's listing. A listing in this case is something the user has for sale. A user can have multiple listings.

I thought of passing parameters in segments to the controller - including 2 segments that would pass as 2 parameters to the controller's index function. eg:

to edit a listing: controller/index/edit/listingID
to add a listing: controller/index/add/null

That worked great until I submitted the form - the action/destination of the form is the name of the controller, and does not have the parameters in it, so I get an error message saying the parameters for the index function are missing.

Then I thought of having an edit function and an add function in the controller, but then I don't know how to do the validation and loading of the view in a single function, such as the index function.

I would be grateful to hear from anyone who has done this.

Thanks!


  New session library (CI 1.7) vs DB Sessions.
Posted by: El Forum - 10-31-2008, 03:43 PM - No Replies

[eluser]Nonox[/eluser]
Hi everybody!
I have been testing the new session library in CI 1.7, and I could see that the user data is stored in the database and non in the cookie, that's way I'm asking you, is necessary to change the new session library in CI 1.7 for another like DB Sessions?

Thanks you for your time.
NB.
PD: Sorry for my english, I'm not a native speaker. :cheese:


  FCKeditor integration
Posted by: El Forum - 10-31-2008, 03:10 PM - Replies (12)

[eluser]umefarooq[/eluser]
Hi
im trying to integrate FCKeditor in my project but facing some problem i use to the following way to integrate the editor

FckEditor

it gives me the following error

Fatal error: Call to undefined method Fckeditor::Create()

another thing in above way to integrate editor i have to follow CI 1.5 or have to keep 1.4 also with that.


  Date Helper Addition - get_date_range()
Posted by: El Forum - 10-31-2008, 02:44 PM - No Replies

[eluser]Bluemill Media[/eluser]
Hey all,

Just wrote up this nifty little function and added it to my date helper. Thought some of you may find it useful as well.

Remember: It returns a range of dates that INCLUDE both the start and end dates. For instance, if you want to return only a week, the $Start timestamp you send should represent the exact day you want to start the range with. So, a date range of one week (See example at the bottom as well):

Code:
// WRONG: $Start = time() - 60 * 60 * 24 * 7;
// RIGHT: $Start = time() - 60 * 60 * 24 * 6;

Here it is:

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

/**
* ===========================================================================
* CodeIgniter Date Helper(s) Extemded
* ===========================================================================
*
* @package        CodeIgniter
* @subpackage    MY_Helpers
* @category    Helpers
* @author        Lorren Biffin
* @link        N/A
*/

define('DAY', 60 * 60 * 24 * 1);

/**
* ===========================================================================
* Get range of dates, between $Start and $End.
* ===========================================================================
*
* @param    Start - Date to as the start of the range. (timestamp)
* @param    End - Date to as the end of the range. (timestamp)
* @param    [Timestamp] - Return array as timestamp values? (bool:false)
* @access    Public
* @return    Array - timestamp or 'Human Readable' dates
*/    
function get_date_range($Start, $End, $Timestamp = FALSE)
{
    $DateRange = array();
    
    $StartDay = date('d', $Start);
    $StartMonth = date('m', $Start);
    $StartYear = date('Y', $Start);
    
    $EndDay = date('d', $End);
    $EndMonth = date('m', $End);
    $EndYear = date('Y', $End);
    
    $StartDay = gregoriantojd($StartMonth, $StartDay, $StartYear);
    $EndDay = gregoriantojd($EndMonth, $EndDay, $EndYear);
    
    $Diff = $EndDay - $StartDay;
    $Diff = (int) str_replace('-', '', $Diff);

    $CurrDate = $Start;
    
    for($c = 0; $c <= $Diff; $c++)
    {
        $DateRange[] = ($Timestamp != TRUE) ? date('Y-m-d',  + $CurrDate) : $CurrDate;
        $CurrDate = $CurrDate + DAY;
    }
    
    return $DateArray;
}

?&gt;

Simple Usage Example:

Code:
// Returns last 7 days.
$Start = time() - 60 * 60 * 24 * 6;
$End = time();
$Dates = get_date_range($Start, $End);
echo '<pre>'.print_r($Dates, true).'</pre>';

Lastly, please excuse my coding style. I understand it's a *bit* different than most standards...

If you guys like this, I may hand over more of my snippets. Thanks! Smile


  ms access db config
Posted by: El Forum - 10-31-2008, 02:20 PM - Replies (2)

[eluser]edhrx[/eluser]
Hi
I'm trying to connect an access db. Using odbc but not getting anywhere. This is the configuration


$db['default']['hostname'] = "localhost";
$db['default']['username'] = "";
$db['default']['password'] = "";
$db['default']['database'] = "cops";
$db['default']['dbdriver'] = "odbc";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";

cops = the dsn name.

Can someone 'show me the light' on this as I have tried several combinations with no effect


Ed..


  $this->db->limit Problem
Posted by: El Forum - 10-31-2008, 02:18 PM - Replies (2)

[eluser]LDMajor[/eluser]

Code:
$this->db->where('to',$this->uri->segment(3));
                $this->db->where('picname',0);
                $qcm=$this->db->get('comments');            
                if ($qcm->num_rows() == 0) {
                    $data['yescomm']=0;
                } else {
                    $data['yescomm']=1;
                    $perpage=10;
                    if ($this->uri->segment(4)) {
                        $page=$this->uri->segment(4);
                    } else {
                        $page=1;
                    }
                    $nump=$qcm->num_rows();
                    $nump = $nump / $perpage;
                    if(intval($nump) != $nump)
                        $data['nump'] = intval($nump) + 1;
                    $lim1 = ($page - 1) * $perpage;
                    $this->db->where('to',$this->uri->segment(3));
                    $this->db->where('picname',0);
                    $this->db->limit($lim1, $perpage);
                    $data['comments']=$this->db->get('comments');
                }
I tested the code and without the LIMIT the code works fine
and with it is doesn't select anything!

please help
Dan.


  get_where question
Posted by: El Forum - 10-31-2008, 01:28 PM - Replies (2)

[eluser]Fenix[/eluser]
I am trying to write a query with CI where I want to select all posts in a database that have the status (an enum data type) of anything but "deleted". How would I write this code?

Code:
$this->db->select('post_id,title,name,type,status,description');
return $this->db->get_where('posts', array('post_status' != 'deleted'))->result();

I assume what I have (!=) is wrong. What is the correct way to do this?
Other statuses are "published" or "private".

Thanks!


  Read zip file
Posted by: El Forum - 10-31-2008, 12:43 PM - Replies (1)

[eluser]abmcr[/eluser]
I need to decompress zip file into a server.... only zlib is present into the php extension: a suggest for a class, for code.... Thank you


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

Username
  

Password
  





Latest Threads
Best way to create micros...
by InsiteFX
3 hours ago
Component help
by FlashMaster
5 hours ago
Show logo in email inbox
by WiParson
6 hours ago
Limiting Stack Trace Erro...
by byrallier
Yesterday, 02:21 PM
Bug with sessions CI 4.5....
by ALTITUDE_DEV
Yesterday, 01:36 PM
codeigniter 3.0.1 equiped...
by JustJohnQ
Yesterday, 10:05 AM
Display a custom error if...
by b126
Yesterday, 06:22 AM
Type error in SYSTEMPATH\...
by DXArc
Yesterday, 06:20 AM
v4.5.1 Bug Fix Released
by LP_bnss
Yesterday, 04:52 AM
Retaining search variable...
by Bosborne
Yesterday, 03:20 AM

Forum Statistics
» Members: 85,190
» Latest member: Jacob Martin
» Forum threads: 77,573
» Forum posts: 375,961

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB