Jump to content

Join or Union to Make Query Less Messy?


imperium2335

Recommended Posts

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

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.