Hi,

I want to export user info along with usermeta to csv file. I havent used usermeta table before so dont know how to fetch results in given sequence So far my code is as follows:

PHP Code:
$select="SELECT meta_value,user_login,user_registered    
FROM wp_usermeta 
INNER JOIN wp_users 
ON     wp_usermeta.user_id = wp_users.ID 
WHERE meta_key 
IN ('first_name','last_name','email','age','college','city','mobile','accomodation_required','references') 
AND wp_users.user_login != 'admin'"

        
$resulr=mysql_query($select);
        
$i=1;
        while(
$r=mysql_fetch_assoc($resulr))
        {                    

            if(!
$flag){ 
 
$col=array("FIRST NAME"=>"1","LAST NAME"=>"2","EMAIL"=>"3","AGE"=>"4","COLLEGE"=>"5","CITY"=>"6","MOBILE NO"=>"7","ACCOMODATION REQUIRED"=>"8","REFERENCES"=>"9","USERNAME"=>"10","REGISTERED ON"=>"11");
                    
                    
                    echo 
implode("\t"array_keys($col)) . "\n"
                    
$flag true
                    
            } 
            
array_walk($col'cleanData'); 
            echo 
implode("\t"array_values($r)) . "\n"
            
$i++;
        }