-
Posts
15,232 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
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?
-
I was insulting you? It is. No. What that does is fetch the next row in the resultset, which then updates $requiredItem. It's populating the array with the remaining rows from the resultset. Okay, let's say you don't know what mysqli_stmt_fetch does. In your while loop, you call the function: if it returns good then you put $requiredItem into the array, and if it returns bad then you stop. Clearly mysqli_stmt_fetch does something that moves you row by row through the resultset, right? Now look at the code before the loop. You call mysqli_stmt_fetch. We now know that moves through a single row. However, where your while loop did something with $requiredItem after every call to mysqli_stmt_fetch, before the loop you do not. Think about that.
-
That error very specifically means the thing on the left side of the minus is a string, and what's more, that the contents of the string aren't numeric. Are you sure $page is an int when that error happens? Could it be that you're getting the value from $_GET and the URL triggering the error has an invalid ?page= value?
-
No, you cannot have an array of just keys, because the very nature of a key is that it provides the location to a value. You also cannot have an array with just values, because no keys would mean you wouldn't know where a value was in the array. It was returned by that first useless call to mysqli_stmt_fetch.
-
How to check when a form field is left blank
requinix replied to SaranacLake's topic in PHP Coding Help
Of course not: you try to trim() every value in $_POST, and that's not going to work for values that are themselves arrays. You'll have to find an alternative to array_map + trim... It's impolite to require people to answer every question - especially personal questions. But there may be times when specific questions need an answer for the survey to be useful. Use your best judgment. Yeah, confused. If an answer is required then give an error if they didn't give an answer. If it is not required then don't give an error. -
How to check when a form field is left blank
requinix replied to SaranacLake's topic in PHP Coding Help
You already know the answer: -
How to handle json respond from api endpoint (Uncaught TypeError: )
requinix replied to charlion's topic in PHP Coding Help
The send method does not return a value. Forget XMLHttpRequest and learn about the magic that is fetch. -
Scraping a page should take maybe one second. Dealing with the database, a fraction of a second. All in all 40-50 pages should be, like, a minute. I can't believe that dealing with duplicates takes up 29 more. What's your code?