-
Posts
1,718 -
Joined
-
Last visited
-
Days Won
55
Everything posted by maxxd
-
Loading the URL helper is not the same as loading the view. Follow the link in my post. To be honest, it's not going to be easier. CI4 uses more modern techniques and coding practices so you'll have an easier time not only getting answers to specific questions (the CI4 boards on the forum as active), but you'll be able to google the techniques more generally.
-
It's been a while since I've used CodeIgniter - especially an older version - but I don't see where you've loaded the URL helper. Check here for more information.
-
Where is $error output? I don't see the file `ffmpeg_submit.php` in the source for PHP-FFMpeg on GitHub so I assume it's something you've written. It could be as simple as creating a different variable and outputting that instead of (or in addition to) the $error variable, but as we can't see your code there's no way for us to tell.
-
Yeah, we're gonna need some more information. Copy the error and paste it here. Also, while I appreciate your attempt to not post unrelated code, you do need to post all the related code. We don't need the CSS or JavaScript, but the php and html directly associated with this functionality is necessary.
-
That makes no sense whatsoever given the code you posted. Where is $row defined?
-
There are several possibilities for this; for instance GitHub has secrets, bitbucket has secrets and variables, AWS has AWS Secrets Manager. I'm sure there are other services out there as well.
-
Validating the form, before create user in database
maxxd replied to flap's topic in PHP Coding Help
Typically you'll want to validate twice; first you validate on the client side in order to give immediate feedback to the user, and the you do it server-side to verify the data and protect the overall system. -
I'll admit I personally am not a big fan of React - for whatever reason it doesn't sing to me. I have, however, found that Vue is not untenable from this crotchety old bastard's point of view insofaras a JavaScript framework is concerned if you're determined not to deal with vanilla JavaScript, fetch(), and writing the code yourself.
-
If the OP is looking to find out if the numerical string is a palindrome, recursion isn't necessary. A palindrome is the same forward and backwards; use split(), reverse(), and join() on the input and compare it to the original string. However, the images of code in the first post have nothing to do with palindromes, they're all about something like the Fibonnacci sequence that requinix describes.
-
How to input 2 different $request->input() in foreach
maxxd replied to Nicho's topic in PHP Coding Help
I read the question wrong; please ignore me. -
Try https://www.php.net/manual/en/mysqli.insert-id.php. I'll skip the obligatory advice to switch to PDO for the moment.
-
I thought it might be loading order so I moved things around in my blade template, but that didn't seem to make a difference. Admittedly, I didn't know that console logging was lazy-loaded and I thought you had to specifically declare a script include as type="module" for it to be deferred without the `deferred` attribute being set but that all makes a ton of sense and it's a great place to start looking; gotta admit if it is as simple as wrapping everything in a loaded event I'm gonna be pretty red-faced while saying thanks!
-
This is not related to your actual question, but I'd feel remiss if I didn't point out that you're storing plain-text passwords in your database right now. Look at https://www.php.net/manual/en/function.password-hash.php and https://www.php.net/manual/en/function.password-verify.php. In the long run, your customers will thank you.
-
Hi y'all. I think I'm having a senior moment; I have the following code in `app.js`: import Swal from 'sweetalert2'; window.Swal = Swal; `app.js` is included in my blade templates, where I have a partial that includes this code: <script> console.log(window); console.log(window.Swal); </script> My console output is attached to this post. Note that apparently nothing is attaching to the window object - even if it's just a simple `window.st = "testing";`, that reports undefined as well.
-
This worked in my testing: let regexps = [ new RegExp('test', 'gi'), new RegExp('another', 'gi'), new RegExp('more', 'gi'), ]; let entries = [ 'More string', 'Second string', 'Super string', 'Basic string', ]; // loop through the RegExps let res = regexps.map(re => { // then loop through the strings return entries.map(itm => { return re.test(itm); }) // flatten the resulting arrays and pipe that to some() }).flat().some(e => { return e == true; }); console.log(res);
-
How to Add Element to end of currently Iterating array
maxxd replied to sen5241b's topic in PHP Coding Help
You can also use an ArrayIterator and the append method. From a random project I was working on, $u = new \ArrayIterator([1], \ArrayIterator::STD_PROP_LIST); while($u->valid()){ $x = 2 * $u->current() + 1; $y = 3 * $u->current() + 1; if($u->key() == $n){ // this is set elsewhere in the method; not really important for this example break; } $u->append($x); $u->append($y); $u->asort(); $u->next(); } -
Is json_array a JSON string or an array? Assuming it's an Array object, I'd say drop the square brackets from excludes (I'm assuming excludes is a valid Array object as well). Also, realize that Array.push() returns the resulting array, so if you're not assigning the return to anything you clearly won't see the updated values. Are you getting any errors in your console? What does the code around this look like? There's not really enough here to say with any certainty what issue(s) you're having.
-
Compressing a block of text in js, decompressing in PHP
maxxd replied to BillInKCMO's topic in PHP Coding Help
Please more fully explain what you're trying to do - I'm not sure at all what 'Going from a javascript window.open url with the text compressed to using that string on the server side in PHP decompressed.' means. -
Problems connecting to a database via Doctrine on server vs localhost
maxxd replied to Houden's topic in PHP Coding Help
That's a Redis exception, not a PDO exception. -
A variable not being set and being empty are two completely different things. You'll get errors checking for $_SESSION['owner'] == '' if the 'owner' index of the $_SESSION array isn't set (doesn't exist at all). So technically you should be checking with isset() and testing for empty; personally I have a tendency to use the empty(), but it's important to realize that this function comes with its own baggage. For instance, a false-y value will return true from empty(), so you'll need to plan for that as well.
-
garyed - honestly, it's not as bad as it could be. I first read your post and assumed you were still using the mysql_* functions, at which point you'd be kinda hosed. From your posted error messages, it seems like that's not the case so that's awesome. As requinix said, you're gonna have to just work through it - the nice thing is it doesn't sound like you'll have to completely rewrite most if not all of your code. There were several things that moved up from notice between 7.4 and 8.0; it's just going to be a case of finding those and making sure they don't throw errors.
-
PHP won't interpolate variables inside single quotes, so your search string was literally %$str% in the first example. Inside double quotes, however, PHP will replace the variable with the value it contains.
-
It looks like that'll do what you're looking for, though obviously I've not tested it.
-
If you follow requinix's advice and make the constructor private in the first code sample it's a textbook example of the Singleton pattern. While there was a period a few years ago that people railed against using Singletons, the furor seems to have died down recently. In my experience, 90 percent of the time it's perfect for things like setting up database connections.
-
In your function ecommercehints_confirm_email_field_validation() (yeesh, wordpress really promotes bad ides...), your second if() statement needs to be an elseif() branch. The reason is that in the first if() you're checking to make sure $_POST['confirm_email'] is set, which is correct. In the second, however, you're assuming it is set by trying to compare it to another value. So if you make it an elseif branch it'll only run when the variable is set, which is the behavior you want.