Jump to content

[SOLVED] long query... random output


MasterACE14

Recommended Posts

I have this query that doesn't give any errors, and it is half working.

 

here is the query...

SELECT `AllRanks`.`Rank` , `UserDetails`.`userName` , `Alliance`.`Alliance_Name` FROM `UserDetails` , `AllRanks` , `Alliance` WHERE `UserDetails`.`ID`='91' AND `AllRanks`.`id`='91' AND `UserDetails`.`Alliance` = `Alliance`.`Alliance_ID` LIMIT 1

 

Basically the problem(I think) is with the last part of the 'WHERE'

`UserDetails`.`Alliance` = `Alliance`.`Alliance_ID`

`UserDetails`.`Alliance` is the ID of the alliance the player is in. Column is Varchar. default is blank ''.

`Alliance`.`Alliance_ID`is the ID of the alliance. Column is Integer. Auto_Increment.

 

Basically if someone isn't in an Alliance, then `UserDetails`.`Alliance` will just be blank, and then the query returns nothing because there is no 'blank' alliance.

 

So how do I go about fixing the query to SELECT everything I need, whether or not the `UserDetails`.`Alliance` matches a `Alliance`.`Alliance_ID` or not?

 

Regards, ACE

 

 

Link to comment
https://forums.phpfreaks.com/topic/153713-solved-long-query-random-output/
Share on other sites

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.