Yeah it did, but now I’m back to this:
$stmt->bindParam(':Invoice_Date', date_format(date_create($row[4]),'Y-m-d'));
Notice : Only variables should be passed by reference in C:\xampp\htdocs\cascotax\api\import.php on line 21
Is it being referenced incorrectly?
eh, no, it’s a strict type notice because i’m being lazy.
What it wants you to do is separate this one line into two:
$dateObj = date_create($row[4]);
$stmt->bindParam(':Invoice_Date', date_format($dateObj,'Y-m-d'));
annoying bit of nagware, imo.
I still get it?
$date = date_create($row[4]);
$stmt->bindParam(':Invoice_Date', date_format($date,'Y-m-d'));
Notice : Only variables should be passed by reference in C:\xampp\htdocs\cascotax\api\import.php on line 22
Oh sorry, now it wants you to do the same thing, but to the date_format function.
So… this?
$dateformat = date_format('Y-m-d');
$date = date_create($row[4]);
$stmt->bindParam(':Invoice_Date', date_format($date,$dateformat));
not quite.
$date = date_create($row[4]);
$dfStr = date_format($date,'Y-m-d');
$stmt->bindParam(':Invoice_Date', $dfStr);
That did it.
Is there a way to tell the script to skip null lines or do I have to open the file in a text editor and delete the null lines it contains every time before upload?
check to see if $row[0] is an empty string.
I added this:
if($row[0] == NULL) {
continue;
}
and it appeared to work. I even went back and added a blank line on purpose to test it and I got no errors.
system
Closed
November 4, 2020, 10:40pm
31
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.