Welcome Guest, Not a member yet? Register   Sign In
simple sql query question
#1

[eluser]DocFunky![/eluser]
Hi everyone !

I just have a little question about a query making me crazy.

1 --
Okay so I have an insert query working rather well :
Code:
$data = array(
    
     'nom' => $nom,
     'prenom' => $prenom,
     'login' => $prenom.' '.$nom,
     'password' => 'facebook',
     'email' => $fb_data['me']['email'],
     'mobile' => "00",
     'etat' => "1",
     'role' => "1",
     'ville' => 'ville actuelle',
     'facebook_id' => $fb_data['uid'],    
   );

   $this->db->insert('membre', $data);

And I don't understand why it always insert the data twice ... !



2--
Then I got a second question :
I just wanna found a user with the related facebook_id so i try that :
Code:
$this->db->select('nom');
   $this->db->from('membre');
   $this->db->where('facebook_id',$fb_data['uid']);
   $resultat=$this->db->get();

   echo '<pre>';
   print_r($resultat);
   echo '</pre>';

I've also tried :
Code:
$resultat2 = $this->db->get_where('membre',array('facebook_id' => $fb_data['uid']));
echo '<pre>';
   print_r($resultat2);
   echo '</pre>';

But in both case, the only array I got is :

Quote:CI_DB_mysql_result Object
(
[conn_id] => Resource id #36
[result_id] => Resource id #61
[result_array] => Array
(
)

[result_object] => Array
(
)

[custom_result_object] => Array
(
)

[current_row] => 0
[num_rows] => 1
[row_data] =>
)

So the [result_id] is okay, but there is no data (as far as it is supposed to be printed in [row_data] ?) When I simply try on mysql i got the right result with the right member. But with CI, it doesn't seems to work.

3--
Furthermore, when i Try something like that :
Code:
echo $resultat['nom'];
it isn't considered as an array ..

So .. yeah, I don't really understand .. If anyone could enlight me ?




Theme © iAndrew 2016 - Forum software by © MyBB