Jump to content


callback_before_insert and set_relation_n_n functions

callback_before_insert and s

  • Please log in to reply
5 replies to this topic

#1 elanouar

elanouar

    Member

  • Members
  • PipPip
  • 27 posts

Posted 04 July 2013 - 04:13 PM

Hi,
Before saving all information in the db I would like to get all information that figure into the ‘affectation’ field(generated by set_relation_n_n function).

I tried to use the callback_before_insert function but I have not found the right method to extract information from the array that figure into the callback function that would be called.

 I would appreciate it if you could help me!!

Attached Thumbnails

  • 156.GIF


#2 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 04 July 2013 - 08:10 PM

Within the callback_before_insert function use the $post_array['affectation']. I believe this will return either a comma delimited string

e.g. 1234,5678 or

an array('1234' => 'aaaaa', '5678' => 'test')


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#3 elanouar

elanouar

    Member

  • Members
  • PipPip
  • 27 posts

Posted 05 July 2013 - 10:09 PM

hi davidoster,

tks for your response . I made a call to a callback_before_insert function and for testing I inserted the code below but I do not think that is functional :

function checking_and_sending($post_array)
    {  
	    $z=$post_array['Affectation']; 
		$count = count($z);
		for ($i = 0; $i < $count; $i++) {
     
       echo "Test : ".$z['$i'] . "\n";
    
   }
		


#4 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 05 July 2013 - 11:15 PM

Instead of echo do a print_r to tell exactly what's the type and content.

Also make sure the case is correct on 'Affectation'. It could be 'affectation' instead.


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#5 elanouar

elanouar

    Member

  • Members
  • PipPip
  • 27 posts

Posted 07 July 2013 - 03:37 PM

Hi davidoster ,

I tried to use the print_r and even the var_dump function. Unfortunately I'm unable to extract data from the selected fields of the list.
Is there any other alternative  that could resolve the pb?
Tks in advance.



#6 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 09 July 2013 - 08:54 AM

Share your code along with the structure of the table(s).


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users