Hi everyone hope your all good, I need help So i have a idea how to do it ,I have used search obviously before I posting this and looked on google but its not a detailed version of the idea I neeed , Right oh I want to select to two or more diffrent tables ok, for various codes Im using both Lavalair and wapdesire v2 but obviously in Lavalair birthday, top poster , shouter , member etc is in the users of the sqls part, but on the v2 of the script they are in profiles as you all no, Now I need to join them so I can select username from users and birthday etc from profiles I tried so many various ways its mad as its not having it, now the following code is actually from the v2 scriptBut I cant seem get this working it should work because it calls the db for other stuff , as i said I dont just want it for birthday Im converting alot of stuff to try work for v2 so its not just the birthday code its for everything Im asking for help, Thanks for reading hope your Ideas can gimme bit insipration how to do it Thankyou TonyCode:$birthday=mysql_fetch_array(mysql_query("SELECT b.birthday FROM users a INNER JOIN profiles b ON a.id=b.username WHERE a.id='".$username."'"));
not sure if this will work better in your case, but you can try.
but why you want to use join for this query if you select only one row, and profile and users have the same values "usernames" saved?PHP Code:
$birthday=mysql_fetch_array(mysql_query("SELECT profiles.birthday FROM users LEFT JOIN profiles ON profiles.username=users.id WHERE users.id='".$username."'"));
this query will be enough.
$birthday=mysql_fetch_array(mysql_query("SELECT profiles.birthday FROM profiles WHERE profiles.username='".$username."'"));
There are currently 1 users browsing this thread. (0 members and 1 guests)