Welcome Guest, Not a member yet? Register   Sign In
  Miss handling of the Star ( * ) char in DB_driver
Posted by: El Forum - 10-23-2008, 09:13 PM - Replies (9)

[eluser]Xeoncross[/eluser]
CodeIgniter 1.7.0 doesn't seem to be handling '*' right. I see it is still defined in the DB_driver file - but it is ignoring it.

Code:
var $_reserved_identifiers    = array('*'); // Identifiers that should NOT be escaped

I get the following error
Code:
Unknown column 'ci_topics.*' in 'field list'

SELECT `ci_topics`.`*`, `ci_users`.`email`, `ci_users`.`username` FROM.........

As you can see - it is not skipping the star char when it adds the back ticks. When I remove the ticks around the star and run the query in PHPMyAdmin it works fine.

Code:
SELECT `ci_topics`.*, `ci_users`.`email`, `ci_users`.`username` FROM.........


  how check method exist
Posted by: El Forum - 10-23-2008, 07:50 PM - Replies (10)

[eluser]minhbu[/eluser]
i want to check a method exists in my class but i don`t know to used any function ?
Help me


  CodeIgniter 1.7.0 Released
Posted by: El Forum - 10-23-2008, 05:49 PM - Replies (90)

[eluser]Rick Ellis[/eluser]
Code Igniter Version 1.7 has been released. This version contains a number of new features and enhancements, as well as many small improvements and bug fixes. For a list of all changes please see the Change Log.

If you are currently running Code Igniter please read the update instructions.

Note: If your browser does not display the 1.7 user guide please clear your cache and reload the page.


  need help with URI
Posted by: El Forum - 10-23-2008, 04:15 PM - No Replies

[eluser]mousavi[/eluser]
hi, I’m just starting to use CodeIgniter and I have a problem with segment based URLs.
It doesn’t work when I type my URI. Actually I get HTTP 404 error, even if my $config[‘enable_query_strings’] is set to FALSE in config.php. But when I set it to TRUE the URL works in query string manner.
what can I do? If anybody help, I will be thankful.


  Denormalize a table or How to avoid records repeating in DB join
Posted by: El Forum - 10-23-2008, 03:33 PM - No Replies

[eluser]earlyriser[/eluser]
Hi.
I have the next tables and columns:
BUSINESS: id, name
CATEGORY: id, cat_name
MIX: id, cat_id, business_id
KEYWORD: id, keyword_name
MIXK: id, keyword_id, business_id


And what I need is to make a query for all the business in some category and get their related keyword, but I don`t know how to make the joins for the last part.

I have this

Code:
$this->db->select('b.name, b.description, b.code, b.address,         m.category_id, m.business_id');
$this->db->from('business b');
$this->db->where('category_id', $category_from_form);
$this->db->join('mix m','b.id = m.business_id');
$this->db->join('mixk mk','b.id = mk.business_id');

What I get i all the business in the category that I want but the business are repeated for every keyword they are related.

For example
If I have just 1 business with 2 keywords (let's say "Best Western" as business and keywords: "cheap" "everywhere" I got 2 result rows and I would like to obtain just one.

Thanks.


  from controller to view , how?
Posted by: El Forum - 10-23-2008, 12:58 PM - Replies (5)

[eluser]JayArias[/eluser]
below is my controller , for the main page. How would i go buy adding the query to my VIEW cause if i put the query code in the view it screws up. ive tried several things.

Code:
<?php

    class Home extends Controller{
    
        function Home()
        {
            parent::controller();
        }
        function index()
        {
            
            $this->load->database('default');
            $fetch_news = $this->db->query("SELECT * FROM `news` WHERE `verified` = '1' ORDER BY `id` DESC");
            $news = $fetch_news->row_array();
            $this->load->view('default_view');
        }        
    }


  SQL query with unique keys between two tables
Posted by: El Forum - 10-23-2008, 12:56 PM - Replies (1)

[eluser]jleequeen[/eluser]
I'm trying to figure out how to get a total between two tables but only counting a row once if it is in both tables. Assuming I have the following:

table1

id
0000
0001
0002
0010

table 2

id
0000
0004
0010
0011

I would want to do a count between the tables and only return the unique total between the two. So in the example above the answer should be: 6 (0000 and 0010 would only count once in the total since they are duplicated).

I'm using active record but not sure if I need to write a custom query to do this. Any insight?


  SQL question / advice
Posted by: El Forum - 10-23-2008, 12:06 PM - Replies (9)

[eluser]nevsie[/eluser]
I wondered if any one could offer advice on how to solve a scenario... Its confusing me, and a little beyond my abilities (if it is possible!)...

I have a single table which holds product_ids and category_ids... Simple theory is that a product can be put in more than one category... no problem there...

However, i want to run a search query which returns only product_ids that in two defined categories... for example:

Code:
prod_id     cat_id
  1         123
  2         123
  3         123
  4         123
  1         125
  2         126
  3         126

If i want only product ids that are in categories "123" and "125" i would then be returned "1".
If i wanted "123" and "126" i would be returned "2" and "3"

Can anyone advise me on how and if this will be possible through a (single) SQL query? I am currently working on queries, subqueries, join, union, etc. trying to figure out a possibility... my mind is frying!!!
Help appreciated, N


  Upload has issue with some files "You did not select a file to upload"
Posted by: El Forum - 10-23-2008, 11:06 AM - Replies (17)

[eluser]Diggory Laycock[/eluser]
Hello,

I was wondering if anyone could help me with an issue I'm having with CI's upload class.

I used it in a site last year without any issues. That site only allowed uploading of image files. I'm currently building a site which allows uploading QuickTime .mov files only.

Many files upload correctly, however the occasional file appears to confuse the upload class. It fails validation with the error "You did not select a file to upload" even though the user has.

I've tried spitting out $this->upload->data() and for these problem files it is empty except for the upload paths.

I've tried using Safari on Mac OS X and FireFox on Mac OS X. Both browsers cause the same behaviour in the CI app.

Here's a sample file that causes the issue (sorry it's 17mb):
[removed]

It's most puzzling - does anyone have any ideas?


[edit]

I've reproduced the issue in a test site:
[removed]

below is the code for the upload methods in the test site:

Code:
<?php

class Welcome extends Controller {

    function Welcome()
    {
        parent::Controller();    
        
        $this->load->library('validation');
        $this->load->helper('form');
        $this->load->helper('number');

    }
    
    function index()
    {
        $data['error'] = '';
        $data['uploadData'] = '';
    
        $this->template->write_view('content', 'upload', $data, TRUE);        
        $this->template->render();
    }




    function processUpload()
    {
        $config['upload_path'] = './uploads/';
        $config['allowed_types'] = 'mov';        
        $this->load->library('upload', $config);
        
        if ( ! $this->upload->do_upload())
        {
            $data = array('error' => $this->upload->display_errors('<p class="validationError">', '</p>'), 'uploadData' => $this->upload->data());

            $this->template->write_view('content', 'upload', $data, TRUE);        
            $this->template->render();
        }    
        else
        {
            $uploadMetadata = $this->upload->data();

            $data = array(
                            'uploadData'         => $uploadMetadata,
                            'uploadedFileSize'     => byte_format($uploadMetadata['file_size'] * 1024) ,
                        );
            
            $this->template->write_view('content', 'uploadComplete', $data, TRUE);        
            $this->template->render();
        }
    }    


}


  file_get_contents then perform javascript. possible?
Posted by: El Forum - 10-23-2008, 10:04 AM - Replies (2)

[eluser]new_igniter[/eluser]
Hello,
I am trying to get HTML from a page on another domain, then perform javascript to get an image...not the physical image, but the img src. Below is what I have so far, and it alerts [object HTML Image Element]. Is there a way for me to access the src through that object? Part B of my question, how can I make the HTML available to the javascript without printing it on the screen?

Code:
&lt;?php
$url = 'http://twitpic.com/hmgt';
$xmldata = file_get_contents($url);
echo $xmldata;
?&gt;
[removed]
elem = document.getElementById("pic");
alert(elem);
[removed]

Thanks!!!


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

Username
  

Password
  





Latest Threads
v4.5.1 Bug Fix Released
by kenjis
1 hour ago
Getting supportedLocales ...
by InsiteFX
2 hours ago
Type error in SYSTEMPATH\...
by kenjis
8 hours ago
composer didn't update to...
by Sarog
10 hours ago
Pipe on url modified in %
by kenjis
Yesterday, 02:52 PM
Best way to create micros...
by kenjis
Yesterday, 02:50 PM
How to use Codeigniter wi...
by kenjis
Yesterday, 02:39 PM
extend url_to helper
by kenjis
Yesterday, 02:33 PM
Limiting Stack Trace Erro...
by byrallier
Yesterday, 05:43 AM
External script access to...
by ezydev
04-21-2024, 11:41 PM

Forum Statistics
» Members: 84,995
» Latest member: silumanratu26
» Forum threads: 77,570
» Forum posts: 375,945

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB