We help IT Professionals succeed at work.
Get Started

Problem displaying data from MSSql using FPDF

dogsareit
dogsareit asked
on
87 Views
Last Modified: 2020-02-07
I am in need of some help. I am using FPDF, extracting data from a MS  SQL Server 2014 table. I am using PHP v5.6.25.
I am rather confused about two columns that are giving me grief. One is a money column and the other is a date column.
The money column displays 4 decimals and I need to display it as 2 decimal places.
The date column will not display at all and it stalls the creation of the pdf.
With the date column, I decided to explode the date, reassemble it as a string in the order that I need to display, MM-DD-YYYY, and it will not display.
If I comment it out, it displays the PDF.


This is my select statement:
         $sql = "select SupplierCode,ConfirmNbr,AmtRcvd,DateRcvd, Description,IDOC,InvoiceNbr from importCmsReceipts where  AgencyId = $strAgencyId ";	 

Open in new window


And this is what I have tried as to displaying the date - doesn't work.
$strDateRcvd = $row['DateRcvd'];
$strArray = explode('-',$strDateRcvd);
$strDate = strval($strArray[2]) . '-' . strval($strArray[1]) .'-' . strval($strArray[0]);
$pdf->Cell(30,15,'$strDate');

Open in new window


I am thinking I need to change my sql select statement to put both the money and date columns in the format that I need.
How can I fix this and what am I doing wrong with the date and money columns ??
Any help appreciated.
Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE