I have the following code in a php snippet on an Edit page hoping that it would output the Company field value. My details on my database are as follows
Connection Type: SQL Server
Table Name: dbo.Invoices2
Field Name 1: Invoice#
Field Name 2: Company
Did I write this the way it is supposed to be written? When I have it load on my edit page, it breaks with no error message.
global $dal;
$tblInvoices = $dal->Table("dbo.Invoices2");
$rs = $tblInvoices->Query("Invoice#=".$_REQUEST["editid1"]."");
$data = db_fetch_array($rs);
$CompanyID = $data["Company"];
echo $CompanyID;
I've also tried this:
global $conn;
$strSQL = "select invoice#,company from dbo.invoices2 where invoice#=".$_REQUEST["editid1"]."";
$rs = db_query($strSQL,$conn);
$data = db_fetch_array($rs);
$Company = $date(company);
echo $Company;
What I'd like to use this for is to change the background image for the edit page based on the company name. I already have this working by creating a custom view button from the list page that has the company value built into the URL, but I'd like to get this accomplished without the url variable so no matter how the edit page is loaded or linked to, its showing the correct background for that company.