Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Select Customer add branch address heaing
11-12-2015, 01:43 AM
Post: #1
Select Customer add branch address heaing
Hi All
I am trying to add the Customer branch braddress1 the heading when a customer is selected I can get this to work in place of the phone number but I would like them both.
The issue is with the sql select statement see below

if ($_SESSION['CustomerID'] != '' AND !isset($_POST['Search']) AND !isset($_POST['CSV'])) {
if (!isset($_SESSION['BranchCode'])) {
$SQL = "SELECT debtorsmaster.name,
custbranch.braddress1
custbranch.phoneno
FROM debtorsmaster INNER JOIN custbranch
ON debtorsmaster.debtorno=custbranch.debtorno
WHERE custbranch.debtorno='" . $_SESSION['CustomerID'] . "'";

} //!isset($_SESSION['BranchCode'])
else {
$SQL = "SELECT debtorsmaster.name,
custbranch.braddress1
custbranch.phoneno
FROM debtorsmaster INNER JOIN custbranch
ON debtorsmaster.debtorno=custbranch.debtorno
WHERE custbranch.debtorno='" . $_SESSION['CustomerID'] . "'
AND custbranch.branchcode='" . $_SESSION['BranchCode'] . "'";
}
$ErrMsg = _('The customer name requested cannot be retrieved because');
$result = DB_query($SQL, $ErrMsg);
if ($myrow = DB_fetch_array($result)) {
$CustomerName = htmlspecialchars($myrow['name'], ENT_QUOTES, 'UTF-8', false);
$PhoneNo = $myrow['phoneno'];
$BrAddress1 = $myrow['braddress1'];


Any help would be appreciated
Thanks For All The Great Work
Dave
Find all posts by this user
Quote this message in a reply
11-12-2015, 01:56 AM
Post: #2
RE: Select Customer add branch address heaing
I think there should be a , (comma) after the custbranch.braddress1 field,

Thanks
tim
Visit this user's website Find all posts by this user
Quote this message in a reply
11-13-2015, 08:16 AM
Post: #3
RE: Select Customer add branch address heaing
I got it forgot the comma between custbranch.braddress1, custbranch.phoneno
Thanks

if ($_SESSION['CustomerID'] != '' AND !isset($_POST['Search']) AND !isset($_POST['CSV'])) {
if (!isset($_SESSION['BranchCode'])) {
$SQL = "SELECT debtorsmaster.name,
custbranch.braddress1
custbranch.phoneno
FROM debtorsmaster INNER JOIN custbranch
ON debtorsmaster.debtorno=custbranch.debtorno
WHERE custbranch.debtorno='" . $_SESSION['CustomerID'] . "'";

} //!isset($_SESSION['BranchCode'])
else {
$SQL = "SELECT debtorsmaster.name,
custbranch.braddress1, custbranch.phoneno
FROM debtorsmaster INNER JOIN custbranch
ON debtorsmaster.debtorno=custbranch.debtorno
WHERE custbranch.debtorno='" . $_SESSION['CustomerID'] . "'
AND custbranch.branchcode='" . $_SESSION['BranchCode'] . "'";
}
$ErrMsg = _('The customer name requested cannot be retrieved because');
$result = DB_query($SQL, $ErrMsg);
if ($myrow = DB_fetch_array($result)) {
$CustomerName = htmlspecialchars($myrow['name'], ENT_QUOTES, 'UTF-8', false);
$PhoneNo = $myrow['phoneno'];
$BrAddress1 = $myrow['braddress1'];
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)