-
Posts
15,274 -
Joined
-
Last visited
-
Days Won
432
Everything posted by requinix
-
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.
-
function ssh2_connect doesn't exist
requinix replied to yves2's topic in PHP Installation and Configuration
Don't throw configuration at the problem unless you understand what the problem is and what the configuration can do to fix it. You are using a Linux system. Linux does not use DLLs. But it does use package managers. Don't edit any configuration files yourself and find the appropriate PHP + ssh package to install. Namely, php-ssh2. Installing that will do everything for you. -
I trust code, and the code you created is incorrect. You might discover it soon, or you might discover it later, or you might not even discover it at all, but that doesn't change the fact that it is factually wrong. But whatever. Not my site or my data. Have fun.
-
Actually that's not going to work correctly. Maybe for the one thing you tested but not for everything. This line of code. $V0f14082c['parser-options']=""; That is what has to be replaced with $V0f14082c['parser-options']=array(); Not added. Replaced. And the line that you added needs to be removed.
-
If all you changed was that one line kicken pointed out then apparently you've got more bugs. But obfuscated code is terrible to read. Try fixing all the variable and function names to make more sense (find one that's easy to identify, rename it everywhere, repeat) and then giving the code a once-over to see that it seems right.
-
"global" means that the function can access a variable defined globally (outside the function) by that name - because variables outside of functions are not automatically available inside of functions. That also means it applies only to the function it's being used inside of. (It's also very bad practice to use, so don't try to learn from it, but this code is about 15 years old so...)
-
Source "Illegal string offset" most often means that someone wrote $value[offset] and $value is a string when the code thinks it was an array. Both of your errors reference parser-options, and looking at the code $V0f14082c['parser-options']=""; that value is initially set up as a string. Change that to be an array and see what happens. Please note that from here on, you cannot post large chunks of code - especially after you've made modifications to it. Given that link above, anyone can find the PHP source themselves for reference, so if you need to post any code then please include the smallest portion possible that you think is needed for someone to understand what's going on.