Roundcube Community Forum

 

how to retrive data from database..

Started by pratik_1712, January 20, 2011, 04:29:18 AM

Previous topic - Next topic

pratik_1712

I want to retrieve the details of current user from the "users" table.

How can this be achieved..??
having a little trouble fetching value from mysql..??
help with the syntax
or
redirect to proper resource..

Thanks and Regards..
Pratik

SKaero

Why don't you post the query your using and the error your getting.

pratik_1712

$rcmail = rcmail::get_instance();
$curr = $rcmail->db->query("
            SELECT username FROM ".get_table_name('users')."
            WHERE  user_id=?",
            $rcmail->user->ID);

and now the value of $curr is 3..
isn't it suppose to return the user-emailid..??
or is there any other method to execute the queries..??

rosali

... $curr is the resource id ... you need to fetch the entries ...

while($email = $rcmail->db->fetch_assoc($curr))
  $emails[] = $email;

print_r($emails);
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

pratik_1712