-
Posts
15,292 -
Joined
-
Last visited
-
Days Won
436
Everything posted by requinix
-
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.
-
Video player issue player dont work on every browser vbulletin 4
requinix replied to kerd's topic in PHP Coding Help
We're experts in programming, not experts in dealing with you. -
Video player issue player dont work on every browser vbulletin 4
requinix replied to kerd's topic in PHP Coding Help
If you're not even willing to attempt to troubleshoot this yourself - a problem, let me remind you, that only you can see - then you're going to have problems. We're not saying the solution is to use Chrome. We're saying the first step towards finding the solution is to see if Chrome gave you any useful error messages about why it has a problem. -
Video player issue player dont work on every browser vbulletin 4
requinix replied to kerd's topic in PHP Coding Help
You can't just claim that a .mp4 file is video/ogg. That's a lie. That said, you're also claiming that it's video/mp4, so as long as that is factually true (just because the file is .mp4 doesn't mean it is MPEG-4) then it should work is just about all browsers. All major browsers have an error console you can look at for hints as to why something is not working... -
Different types of returns using gethostbyaddr() and REMOTE_ADDR
requinix replied to ajetrumpet's topic in PHP Coding Help
You know how DNS can turn a name like forums.phpfreaks.com into an IP address like 199.119.180.53? And how if the DNS isn't setup then you can't get to the website? Similar thing for turning IP addresses into names. Sometimes they're configured, sometimes they're not. Nothing you can do about it. -
Problem with calling a method from within a method in another class
requinix replied to barraclm's topic in PHP Coding Help
Would be a lot easier if we could see the code for User.php. Please post it by using the Code <> button in the editor. -
Normalization problems can be corrected at any point - though the amount of effort required varies. But data problems can't be corrected retroactively.
-
It's a perfectly valid approach, sure. As long as you have the data in some form at all then you have what you need. Beyond that the only thing to gain is convenience. The chart stuff is non-trivial. Are you sure you want to make it yourself? Whatever you come up with won't be of the same quality that you can get with a third-party library.
-
Well you can't do much with them while they're still sitting in the database... I figure the "right" approach depends on what you have to provide to generate the chart. You probably need to end up with an array, naturally, but in what format? An array of key/value pairs? An array of arrays? Array of objects? What is the end result as far as the code is concerned?