I’m working with an older API that requires XMLs to be signed. There is no proper documentation and the only code example was given in C#. I need to port this example to PHP. However, the code I’ve written in PHP gets a different output even when provided with the same input, causing the API call …
Tag: php
How can I echo a statement from a form?
I’m a student doing a challenge where I would have to make a Calculator-type form where you can input two values and click an operation. It’s a simple concept using only 4 operations. I was able to make the format of the form: title, input text and buttons. But I can’t find a way to take the…
How to check in PHP if a checkbox is checked or not before posting/submitting?
I’m trying to check if a checkbox has been selected so that if it is, I can then display another textbox, however I’ve tried the below code to try and check if the checkbox is checked or not but keep …
If statement returning false result using date and strtotime
I’m trying to use an if statement to say “If today is between two dates, do this…” etc. It’s not working, and I’m at a total loss because as far as I can see – it SHOULD work! if (date(‘d/…
How to install PHP 8 on XAMPP
I’m trying to update my PHP version to the brand new PHP 8. I have followed simular steps as this tutorial. But now the following error is shown: Notice: I have used a brand new XAMPP instalation version 7.2.33. I can’t find the solution for my issue. Edit It is saying that I need to look into the…
Allowed Memory Size Fatal Error; Improve Script
I have the following function which returns a formatted table to me showing me the list of browsers that viewed the website. It is retrieved from the MySQL Database and the User Agent (I know not totally reliable but it’s good enough for this at this point in time). However; this function (and another t…
PHP/JavaScript apparently not detecting JSON API as valid
I’m trying to make a simple API with PHP and a way to retrieve data from it in JavaScript but I keep getting the following error: SyntaxError: Unexpected token < in JSON at position 0. The JSON is valid and I’m not sure what is causing the error… I’ve tried setting headers and the d…
Datatables: how to preserve id when sorting through a relation from another table (yajra, laravel)
I’m using datatables from yajra datatables and I have a problem. I have a datatable where I obtain certain columns from other tables, for example the column “customer” is obtained through a relation from another table But when I press the sort by customer button, the IDs change to the ID of …
PHPUnit always output “No tests executed!” on MacOS Big Sur
When trying to run any PHPUnit tests, I always get a No tests executed! message on my MacOS machine. A simple way to reproduce, on this specific machine, is to install a fresh instance of Laravel and running the default tests : The expected output would be OK (2 tests, 2 assertions). As far as I know, this is…
Trying to use string as foreign key in laravel
I am just a beginner and trying to use string as foreign key in laravel but getting this error while fetching the data:- SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘read’ in ‘where clause’ (SQL: select from as sender_id, count(from) as messages_count from messages where to …