I want to allow inputs like _X_C or _X_X_X with the following regex: The following should be allowed only once: _X_C _X_L _L or … _X_X_X (0 to threetimes) The only thing that does not work is the allowance of “_X_X_X” or even “_X” What did I do wrong? Answer You may use See the r…
Tag: php
Updating and deleting from a data table, warning undefined array key
I have been following a lesson on how to make an admin page. I got all the information out of my database to a table on the page. I have an update button and when I change the information and press the button I receive this error: Warning: undefined array key “WebID” in ..Update.php on line 3 From…
Find and Replace Multi-Row Phrases/text Within PHP Arrays without damaging the array
Lets say I have an array: Keeping the structure of this array intact, I want to be able to replace phrases within it, even if they spill over to the next or previous string. Also I don’t want punctuation or case to impact it. Examples: String to Find: “Sundays which are also pretty good” Rep…
React app not sending files to php server with Ajax
I’m hosting a react app on my apache server. I’m using react-images-upload npm package to receive an image from the user then post it to my php server with Axios. However when I check the php $_FILES array in the response it’s empty. I have tested wether my server can receive files with a li…
“Error [Semantical Error] The annotation “@DoctrineORMMappingOnetoMany” in property” on Gitlab CI but not in local env or production [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed las…
Only some values are editing with a form Laravel 8
I am using a form and I don’t know why I can edit with it the values except in the fields apellido and cedula. I am using the same logic in all the form fields so I dunno what can be causing it. I’m gonna post the code of the view, controller, and model. View Controller Model I have no
Query One to Many Relation in Laravel 8
I have one to many relation for User and Student. Model User.php Model Student.php and in Controller.php it will run and return json can I custom select in Students, only show firstname and lastname ? Answer You should use API Resources for this. Here’s a link to the official documentation: https://lara…
Laravel Eloquent how to get relationship self object?
I have tables with below relationship And my HousingAdvertisement model has and HousingAdNearPlace when I make query like this: I got HousingAdNearPlace object in HousingAdvertisement model: How can I got self NearPlace model like this: Answer You need “Has Many Through” relationship on HousingAdv…
PHP 8 Attributes: Is it possible to validate metadata passed to attributes or force attribute instantiation?
Playing a little bit with the new PHP 8 attributes (annotations) (https://stitcher.io/blog/attributes-in-php-8) I started to create my own ones. Simple example: Hoping that the following code would throw an BadAttributeMetadataException unfortunately it finishes successfully: Is there away to validate the met…
How to insert code as code inside a document
I’m working on a little project for myself to try and make a documentation page, Now everyone knows the basic echo ‘hello world’ inside of the PHP tags like so: yet i have this in an HTML document and was wondering. Is there a way to display PHP code inside of HTML code? or do i need to appr…