Jump to content

Need to get all Users Info - Returns 1 Row


unemployment

Recommended Posts

I need to get all of this info for all of my users, but right now if I remove the where clause I still only get 1 row returned.  What am I doing wrong?

 

$sql = "SELECT
                `users`.`id`,
                `users`.`firstname`,
                `users`.`lastname`,
                `users`.`username`,
                `users`.`email`,
                `users`.`gender`,
                `users`.`accounttype`,
                `users`.`personalweb`,
                `users`.`guestviews`,
                `users`.`iviews`,
                `users`.`eviews`,
                `users`.`credentials`,
                `users`.`specialties`,
                `users`.`country`,
                `users`.`city`,
                `users`.`state`,
                `users`.`phonenumber`,
                `users`.`dateofbirth` AS `dob`,
			`users`.`mail_status`,
                `investor_info`.`investor_type`,
                DATE_FORMAT(`users`.`dateofbirth`,'%D') AS `dayofbirth`,
                DATE_FORMAT(`users`.`dateofbirth`,'%c') AS `monthofbirth`,
                DATE_FORMAT(`users`.`dateofbirth`,'%Y') AS `yearofbirth`,
                DATE_FORMAT(`users`.`dateofbirth`,'%D \of %M %Y') AS `dateofbirth`,
                DATE_FORMAT(`users`.`signupdate`,'%D %M %Y') AS `signupdate`,
                SUM(`investor_info`.`capital_available`) AS `totalavailable`,
			`companytype`,
			`capital`
            FROM `users`
            LEFT JOIN `investor_info`
            ON `users`.`id` = `investor_info`.`uid`
            LEFT OUTER JOIN employees
            ON users.id = employees.userid
            LEFT OUTER JOIN (
			SELECT 
				companies.companyid, 
				companies.companytype AS `companytype`,
				SUM(companies.capital) AS `capital`
			FROM  `companies`
			GROUP BY companies.companytype) SumCompanies
            ON employees.companyid = SumCompanies.companyid
            WHERE `users`.`username` = '${username}'";

might depend on how you are displaying the query. Are you using a loop to do this?

Might help if you posted the code as well

 

The problem is not in the code, but rather in the query.  Phpmyadmin does not display multiple rows when I run the query.  I would ultimately end up using a foreach loop for the output, but I need to get the query correct first.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.