Skip to content

Tag: php

convert large data in json format

i have a table named mobile in which all the mobile data is contained which have more then 7000 records now i want to display in json format but some how records are not showing here is my code kindly check .. table Answer The problem with JSON_ENCODE in PHP is, it tends to add double quotes and escaping sequ…

Accessing Laravel .env variables in blade

I am trying to get some API keys which I have stored in my .env file to use in the blade javascript. I have added two keys like: In blade I need to use the Google Maps API and OverheidIO API key. I have tried getting one of the default .env variables just in case I have formatted the custom

Regex for 24 hour time

I have found a working expression for accepting only 24 hour time, but my problem is it will accept things before and after such as characters awf23:59fawf 23:59gfes 123:59 Are all accepted, I want to stop allowing this and only accept HH:MM within my statement: if (preg_match_all(“~((2[0-3]|[01][1-9]|1…

PHP MySQL Error echo insert into values printing on screen

I am learning PHP MYSql and faced an error while writing a marks submission program. When i run the program in chrome, the table is coming ok but neither the values are inserting in the MySQL table nor the redirection to different webpage taking place. You will understand it more clearly in the code and scree…

preventing abuse of API service usage

I am planning on using Laravel in my next web project, for the backend. Using the Laravel’s built-in functionality I will build an API service. So my main concern now – is about the security of such service. Laravel’s API throttling middleware seems to be an easy to use solution, but it does…

How to remove spaces from my php

When I run my php code it shows the content perfectly, but there’s a space after start and before stop. How do I remove all spaces? I thought that’s what I was doing with trim? Answer You should trim all the whitespace characters, like this:

Laravel 5.4 required if validation issue

I have 2 fields, accepts_usd and price_usd. For price usd I have a validation rule: And for accepts_usd: When I want to store data if I set accepts_usd to false it still asks for price_usd. whats the issue here? What am I doing wrong? Answer From laravel docs: required_if:anotherfield,value,… The field …