Jump to content


Hoergold2's Content

There have been 3 items by Hoergold2 (Search limited from 19-January 20)


By content type

See this member's

Sort by                Order  

#3532 set_relation_n_n very slow

Posted by Hoergold2 on 19 September 2012 - 03:17 PM in General

Hi,

I myself also found that the CRUD does not work usable enough (browser goes off for some time etc.) if I try to use the n:n-relation on something like "authors" to an "book".

There are many, many Authors in the Author-table (>60k), but just to e.g. edit a Book (looking up the related Authors like 1, 2 or 3 in the relation-table and then showing the names (better would be: being able to build something to show "Name, First Name" because many Authors have the same last Name)) should not consume so much time etc.

It seems every single Author is loaded somewhere in the background - and that is not neccesary and seems to be the problem.

Does anybody has an idea about that?

Thanks,
Martin



#3531 Priority Field Relation in the set_relation_n_n function

Posted by Hoergold2 on 19 September 2012 - 03:13 PM in I have a question

Interesting: I asked myself the same question (what is this field for). As I understood it it comes from a special use case and does add some nice funtionality (drag'n'drop to reorder the persons). But allow me the suggestion that it could be explained also in the API - maybe one time very clear for all..

Thanks,
Martin



#3530 Want to sql my own table in a callback function - how?

Posted by Hoergold2 on 19 September 2012 - 03:05 PM in I have a question

Hi there,

I found this CRUD tool it is awsome, great, superb - what everyone waited for some years and someone finally did it! Thanky!

As I am quite acquainted with PHP but totally new to Codeigniter (that is needed by GroceryCRUD I do not get the idea how I can query the databse (using Codigniter-Helpers in a Callback function. What I want to do is to check a (German) postal code that is typed in in a form and lookup the state where it is located. The needed data sits in an own table.

What I tried:

$crud->callback_before_insert(array($this,'plz_code'));

and then:

   function plz_code($post_array)
   {
   
    $plz = $post_array['plz'];	 // $plz = $this->db->escape_str($post_array['plz']);
    $ort = $post_array['ort'];	  // $ort = $this->db->escape_str($post_array[ort]);
   
    $query = $this->db->query("SELECT plz, ort, land from orte WHERE PLZ = $plz and ort = $ort ");
    if (count($query->row_array() > 0 )) {
	    $result = $query->row_array();
		 $plz_code = $result['Land'];
    } else {
	 $plz_code = 'XXX';
    }
	
    $post_array['b_land'] = $plz_code;
    return $post_array;
   }

I hope - though it is more a Codeigniter problem (that I am totally new with) - you might help with some lines? I would appreciate it very much!

Thanks in advance,
Martin