-
Posts
15,292 -
Joined
-
Last visited
-
Days Won
436
Everything posted by requinix
-
Your composition is backwards. Consider if you injected Cat/Dog/Mouse into Animal. It's a simple question but how would you type that property? class Animal { /** * @var ??? */ private $dna; You can't. You'd have to make each animal itself inherit from some "Dna" thing. Which would make this all the more complicated. But if you did composition the other way around, you would have class Cat { /** * @var Animal */ private $animal; Of course this isn't quite inheritance in the normal sense. It's the concept of inheritance but implemented using composition. Actual inheritance would be "class Cat extends Animal" and thus you'd have to somehow get Animal's data directly into Cat. Not sure if Symfony/Doctrine can do that, but if it were custom code then it wouldn't be hard (SELECT * FROM cat JOIN animal...).
-
reading fingerprint in php web base system (PDO)
requinix replied to naflinmoha's topic in PHP Coding Help
Stop searching StackOverflow and start learning how to write software. Getting Started guide -
Forum messsage problem. Charachter limit and 503 error.
requinix replied to Oktopus's topic in Apache HTTP Server
If you copy your code directly into the post editor then our forum will see the spoilers and convert them to HTML. Instead, click the Code <> button in the post editor, copy your code into the popup, and use that to insert into a new post. You should not need to use wordwrap(). If a long post stetches the page then that means the post is not acting like normal HTML is supposed to act. Can you give us a link to a webpage that shows a long post? -
Also, that article you linked is absolutely terrible. Stop using that site, and I'm also going to ask you not to link to it in the future.
-
exit() can terminate all execution, yes. It is almost never appropriate to use.
-
If those words you wrote were intended to ask about whether your PHP script has to be executed in order for that Javascript to be sent to the client, the answer is yes. Perform obvious validation with Javascript (which you include with the form or in an external .js script), like checking required fields and value formats, then do the same stuff in PHP plus whatever else because you can't trust Javascript validation to be secure. You can use form field attributes like "required" and "pattern" to make the browser do that validation instead of needing Javascript, but in exchange for the convenience you give up most customization of the error messages. Which may be perfectly fine for you.
-
datatable, condition to add class details-control
requinix replied to nitiphone2021's topic in Javascript Help
Okay... Not entirely sure what all that means. Mostly I was asking to see if there was some way to set things up so that you wouldn't actually need that details-control class to begin with. Honestly, I think that could be possible. Take a look at the createdRow callback option. -
So, like, this is going into some sort of table, and you want to be able to add columns to list in that table without having to change a whole lot of code? Like I said, fix the query to return only the columns you care about. Want to add a new column? Add it to the query. Really easy. Then when drawing the table or whatever, you can use a simple foreach($row as $column => $value) and output it as you want because $row will only have the columns you care about.
-
datatable, condition to add class details-control
requinix replied to nitiphone2021's topic in Javascript Help
Out of curiosity, what does the details-control class do? -
You've come up with a solution, but the only problem I'm hearing is "I'd like to get an array with the id and type columns from my query". If you issue the proper query, which you should be doing anyway because retrieving every column from the table when you only want a couple is wasteful of both time and resources, then you'll get an array with those columns because they're the only ones in there to begin with.
-
If you only want the id and type fields then why don't you simply SELECT id, type FROM orders
-
Does it give information about the 500? And I know you say Windows Server, but are you using IIS specifically? (Probably.) If you're using IIS, the issue is likely because IIS's user account does not have access to the files. Which is a good thing. Put your PHP code near the same place where your other website files are.
-
Can you be more specific about the problems? Any error messages, either from PHP or from your web server, on the screen or in log files? And are you using IIS?
-
Is it fair to say that all apples can be substituted for pears but not all pears can be substituted for apples? I don't know. I'm telling you there is no conversion process because annotations and attributes are two different things. As far as PHP is concerned, docblock annotations are just comments. Just comments. Nothing else. The whole reason those things work is because some library is using reflection to grab the docblock string for a method or property, then parse it for @things. Different libraries parse different ways. Meanwhile attributes are an actual language feature.
-
If you're going to be prepending data to the file then you're also going to need to deal with file locks. In case two different PHP requests try to update the counter. Obligatory "but you really shouldn't be using a file for this" comment here.
-
https://https//rblxlimitedz.000webhostapp.com/api.php?id=316 Look at it.
-
Somewhere in your code you wrote "new Choices(...)". Hopefully you assigned that to a variable, like the example does with "const example =". Call setChoiceByValue("AFG") on that variable.
-
If you're talking about jshjohnson/Choices then it looks like the setChoiceByValue method is what you need to use. If you aren't talking about that then a link to its website would be nice - though I do recommend reading said website for information beforehand, in case the answer is there already.
-
What library are you using to make this select/option widget? It should provide an API for you to use where you can tell it which option you want to be selected and it will do the rest of the work for you.
-
What Javascript code have you written so far, and what happened when you tried it?
-
Should you pass models directly to view - Laravel
requinix replied to Drongo_III's topic in PHP Coding Help
There's going to be coupling somewhere, both regarding database structures and what you do in the view. And from a practical standpoint, the database really shouldn't be being revised so much that coupling is a problem. If you don't like passing database models then create and use business models, which look a lot like database models but aren't tied directly to the database. Of course now your views are tied to those models, bringing us right back around to the "stop screwing around with your data structures" argument.