-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
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. -
Step away from the computer. Get a sandwich. Watch TV. Kill things in a videogame. Come back to it another time.
-
If you're having problems with the stuff you've written so far then posting the stuff you've written so far would make it a lot easier for us to identify why you're having problems. That said, you want to show numbering on the page, right? Don't put the number in the database. Just use a variable like $row = 1, output $row where you want to show it, then $row++ so it'll be ready for the next person (if there is one).
-
Can not access to the website and no content displayed
requinix replied to hin's topic in MySQL Help
The error message seems to rather clearly indicate that there is no "app" database. Have you tried looking into that? -
Errors that make no sense to me. What am I doing wrong?
requinix replied to guymclarenza's topic in PHP Coding Help
https://www.php.net/pdostatement.exec The next problem is the faq variable, but there is no "$faq" in the code you posted. After that is the foreach problem. Where is $table being defined? Then after you fix that you may or may not have another problem with the foreach - depends what you do to fix the $table issue. -
See, the problem here is that there is clearly much more to your code than just the little bits you've posted, and there could certainly be problems elsewhere that would explain whatever issues you've having. For example, maybe your PDO options are not set up to throw exceptions when things don't work, which would mean you would have no idea whether calling ->exec() worked or not. Look into what you need to do to change that behavior.
-
Of course it needs to exist: you're trying to use it. Can't very well use something that doesn't exist, can you? But perhaps it's not a "Config" class you need to use?
-
If the new question is related to what happened in this thread then go ahead and reuse it. Otherwise a new thread is nicer.
-
A loop isn't a mystical thing that does work for you. It's merely a tool. A means to an end. So the question you should be asking is whether something, a page or a function or whatever, needs loops to perform its necessary tasks. And odds are that if you have more that one of some things then you'll need a loop to process them. So you have a one-to-many relationship? That is, every single row in "table" has one or more corresponding rows in "anothertable"? You're absolutely right to consider an INNER JOIN. It will be far, far more efficient for you and your database if you issued one single query to retrieve all the data at once instead of one for the first table and another N for the second table. But you're also right that it won't be obvious where one id/name stops and one id/name begins... ...unless you do what is probably going to sound obvious in retrospect: make the query also return the id and name. SELECT t.id, t.name, at.field1, at.field2 FROM table t JOIN anothertable at ON t.id = at.field3 ORDER BY t.name, at.something When you go through those results (with a loop), track the previous id and keep an eye out for when it changes. Note that sorting the results is key for this to work, since otherwise there's no particular guarantee on whether all the rows for a given table.id show up together, but it's also probably something you'd want to do anyways. Essentially, previous id = null foreach row { if current id != previous id { new heading } print row previous id = current id } In practice it tends to be a little more complicated than that, depending on what kind of output you want - especially if it's HTML, and especially especially if you want syntactically valid HTML.
-
Probably. If not then it's really close. The foreach loop would be more used with ->fetchAll() - if you had multiple rows, of course.
-
Are you having a specific problem with $title and $wname and all those not being set? Errors about invalid offsets? Loops are for multiple things, right? Because the whole point of the loop is that it does something multiple times. So if you only have one row then it would make sense that you do not need a loop. fetch() returns a row - presumably an array, given that code you already have. Try removing the foreach (and adjusting the variable names) and seeing what happens.
-
If you know that the string will always be in that format then you can ask PHP to parse it for you.