imperium2335 Posted September 16, 2010 Share Posted September 16, 2010 Is there a cleaner way to do this? $query = "SELECT branches.Language FROM eua_users, branches WHERE eua_users.AssignedBranch = branches.country" ; include("dbconnectlocal.php") ; $result = mysql_query($query) ; $row = mysql_fetch_object($result) ; $usrlang = $row->Language ; $query = "SELECT UserName, Email FROM eua_users WHERE UserName = '$user'" ; include("dbconnectlocal.php") ; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_object($result) ; $branchmail = $row->Email ; $query = "SELECT $usrlang FROM autoreplies WHERE ReplyID = '0'" ; include("dbconnectlocal.php") ; $result = mysql_query($query) or die(mysql_error()) ; $row = mysql_fetch_object($result) ; $message = $row->$usrlang ; $query = "SELECT $usrlang FROM autoreplies WHERE ReplyID = '1'" ; include("dbconnectlocal.php") ; $result = mysql_query($query) or die(mysql_error()) ; $row = mysql_fetch_object($result) ; $url = $row->$usrlang ; $query = "SELECT $usrlang FROM autoreplies WHERE ReplyID = '2'" ; include("dbconnectlocal.php") ; $result = mysql_query($query) or die(mysql_error()) ; $row = mysql_fetch_object($result) ; $subject = $row->$usrlang ; Link to comment https://forums.phpfreaks.com/topic/213554-join-or-union-to-make-query-less-messy/ Share on other sites More sharing options...
ignace Posted September 16, 2010 Share Posted September 16, 2010 SELECT $usrlang FROM autoreplies ORDER BY FIELD('0', '1', '2'); Link to comment https://forums.phpfreaks.com/topic/213554-join-or-union-to-make-query-less-messy/#findComment-1111613 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.