Jump to content

requinix

Administrators
  • Posts

    15,227
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. The only require you need is for vendor/autoload.php. Remove the others. "PHPMailer" is the name of the class, yes, but it also exists in a namespace. Do you have at least this particular use statement use PHPMailer\PHPMailer\PHPMailer; at the top of your file? I'm grabbing that directly from the packagist.org page you linked to.
  2. requinix

    num_rows

    You're mixing PDO and mysql. Which is bad for two reasons: you're mixing two different libraries together (so of course they won't work) and one of them is the old mysql library (which is so bad it's been removed from PHP). You're using PDO. That's good. Find out what the "num rows" solution for PDO is. Hint: look in the documentation to see if anything seems relevant.
  3. If you're asking why it shut down unexpected, it may be due to a blocked port, or missing dependencies, or improper privileges, or a crash, or a shutdown by another method. To find out why, you should press the Logs button to view error logs. You can also check the Windows Event Viewer for more clues. But if that still doesn't work, you can copy and post the entire log window in the forums.
  4. Seems you've already done that. So what's the problem?
  5. Yes it will. If something throws an exception, it bubbles up to the closest try/catch, and if that doesn't handle it (or throws it again) then it continues up to the next-closest try/catch, and so on. Doesn't matter what functions those try/catch blocks are in.
  6. What do you mean "ideally"? That is how it will work: if any of those three methods throws an exception then the try/catch will catch it. Because that's what it does.
  7. If you're asking what you have to do to make this work, the answer is: I don't know what the answer is because all you've given me to work with is a bit of HTML and something that may or may not match the CSS rules you're actually using. What I do know is that what you're trying to do, in principle, does work. Which is why I offered the advice of how you can find out what the problem is, by which I mean a way for you to "debug" the CSS. Find out what rules are and are not applying, with your actual site that only you can see, and that should help you get closer to finding out what you have to do to make this work.
  8. Working for me. https://jsfiddle.net/w936eko0/ No, you can have as many rules as you want, even duplicates, but it does mean you need to pay attention to conflicting rules. Which is what I think is going on here. Use your browser tools to force the .porto-ibanner into a hover state, then check what CSS rules it is and isn't applying.
  9. Sure, but does it contain a .porto-ibanner than contains another .home-banner that contains another .porto-ibanner that contains an image? Shouldn't that whole thing be just .home-banner .porto-ibanner:hover img { filter: brightness (50%); }
  10. If that's literally what you tried then I'm not surprised it didn't work: home-banner and porto-banner in that selector twice? That doesn't seem right.
  11. So fix the code to include the charge with the withdrawl amount when attempting to deduct from the balance? Remember that we have no idea what you're working with, let alone any clue about the sorts of code involved, so it's going to hard for us to say much unless you can provide quite a bit more information...
  12. Just arbitrarily rearranging elements like that, not really. You can't change the fundamental structure of the page. But you can, to some extent, make things appear in different locations or arrangements. Depends on the exact markup and the sorts of CSS things you want to do with them...
  13. git is a tool to track and manage changes to files. There's no way to properly explain it here, but the point of it is that you can make changes to files and keep a full history of everything that's happened. It's something you should start learning to work with now, as it's practically universal with software programming, but you can slowly ease yourself into it. The main concepts to deal with now are cloning (making a copy of the repository that's in GitHub), pulling (downloading recent changes), committing (saving the changes you've made locally), pushing (uploading everything back to GitHub).
  14. Regarding Docker, there are two fairly common problems with software: 1. If I want to edit and test and run code, if the code has particular requirements, I have to set up my machine with those requirements. And that makes it hard to edit/test/run other code which has similar but different requirements. 2. When I want to deploy my edited code, it has to run on a server, and that server has basically the same sorts of requirement problems. What Docker does is solve those by providing a self-contained environment. So I can edit and test and run code in its own isolated environment, with its own requirements, then do that with other code at the same time without worrying about the two of them conflicting. Those problems used to be solved, not that long ago, by virtualization. Which is a self-contained environment too. The difference is that virtualization was basically a tiny little software-based computer that you'd have to boot up and such just like an actual computer, while Docker uses features in your operating system to give you something isolated without having to deal with that full "computer" experience. "Docker Hub" is a central place for people to upload their "images", which are basically archives of all the files needed for whatever. For PHP, there are images that give you php-fpm, and those images contain all the files php-fpm needs to run. Same for MySQL, and Apache, and tons and tons of other things. What one typically does is then assemble those images into a "stack" and then add a little configuration to make them talk to each other. So you take php-fpm plus MySQL plus Apache, have php-fpm talk to MySQL, have Apache talk to php-fpm, and then you can point your browser to the Apache piece and have a fully-functioning site. All without having to actually install php-fpm or MySQL or Apache on your computer. It's not a total improvement, though. Like, it is going to take up more disk space: those images have php-fpm/MySQL/Apache installed in them, but remember that each image is isolated, and that means each image also needs some amount of installed libraries and whatnot, resulting in taking up more space. Plus, the way images work, there's also some wasted space going to happen. However, the benefits of dealing with Docker greatly outweigh concerns of space usage - especially in a day and age where disk space is plentiful and cheap. GitHub provides an internet-hosted git repository for you to use, but it's not a replacement to having files on your own computer. You still want everything available to you to edit and all that. But it does offer a number of advantages, like acting as a backup, and having a place to coordinate work with other people, and a bunch of other things. That's why I say you don't have to worry about it for now. It doesn't provide some sort of brand-new development experience that will fundamentally change what you're doing now. It provides additional features. That said, the one thing that would be useful to take out of it now would be as a place to back up your work: do what you want, "commit" (save) your changes, "push" (upload) them to GitHub, and then not have to worry about losing all your work because your computer caught on fire. GitHub isn't the only such place, of course. GitLab and Bitbucket are two popular alternatives, and they all provide basically the same sorts of features. "Mode" isn't right, but otherwise yes. When you make a git repository in GitHub, you have the choice of making it public or private. Public repositories are public: anyone can see it and read the code, anyone can "fork" (copy) it for themselves, and anyone can "submit pull requests" (suggest changes) - though you're not forced to accept the changes, of course. Private repositories are the opposite. And yes, you can change your mind later.
  15. That there is especially important code you have to look at - it does say "http://" after all. But you should fix this by not doing any https:// or HTTP_HOST stuff. You should use simple URLs that are just paths on your site. As in "/admin/propertyImages/stuff.jpg" and not "https://www.luxurybeach.com/admin/propertyImages/stuff.jpg". The browser can take the path and figure out the rest perfectly well. So with that $ImageUrl variable, keep the /admin/ because your URLs in the database don't have that, but get rid of the rest. I would do it like: $printTXT = ""; while ($line = mysql_fetch_row($resuls)) { $ImagePath = "/admin/" . $line[2]; $pname = $this->wordcount(trim(str_replace("Puerto Vallarta Rental", "", str_replace("-","", $line[1]))), 25); $printTXT .= "<div class=\"sldie\">\n"; $printTXT .= " <a href=\"/". $line[0] . "/" . $line[1] ."\"><img alt=\"$pname\" border=\"0\" height=\"390\" src=\"$ImagePath\" width=\"625\" /></a>\n"; $printTXT .= " <div class=\"caption\"><h2><a href=\"/". $line[0] . "/" . $line[1] ."\">" . $pname . " <span>" . $line[4] . "</span></a></h2></div>\n"; $printTXT .= "</div>\n"; } $printTXT .= "\n"; return $printTXT; where I get rid of $prphost and $host, rename $ImageUrl to $ImagePath (it's more accurate of a name that way), and write the "/" and "/admin/" prefixes right there on the lines (since it's just a slash now and not the more complicated stuff).
  16. You test it by entering "http://luxurybeach.com" in your browser and seeing what happens. But I'll do it... The redirects look fine. You're using Apache and really ought to be doing the redirects with that instead of PHP. I saw a 404 on the homepage once but couldn't see what it was for, and I'm not seeing it again, so I don't know. I do see that a lot of images are being loaded over HTTP, but the browser is being smart and knowing it should go over HTTPS instead. You still ought to fix that. The images are /admin/propertyImages/stuff.jpg and I don't know for sure where those particular URLs are coming from. Now, Correct. But this isn't a PHP problem. This is a server configuration problem. It doesn't know how to handle a URL like /real-estate-sales/1/2. My guess is that you have a HTTP server configuration and a second HTTPS server configuration, and the latter isn't set up the same way as the former.
  17. ...okay, yeah, new, I can see that... I don't know what you mean by that. JSON is a syntax for writing data, and VS Code does use JSON for most of its data, but it's also not something you typically have to deal with - like, there is a regular UI for changing most settings. Where? VS Code is designed for use with many things done through a keyboard. By which I mean, for a lot of things you might want to do, you do so through the "command palette" and not by clicking a button somewhere. For example, if I want to select a lot of lines in a file and sort them, there is no menu I can click through to find that. But if I open the command palette and type "sort", I have the option of "Sort Lines Ascending" (and some other things) that I can choose. That's not to say you don't use the mouse. There's still lots of things that you can/should do through clicking, but VS Code isn't like MS Word or something where there are toolbars to navigate through. So that's what I think you mean by "commands". I don't know what "paths" you are talking about, but that word typically means a file or directory. I don't know what the installer is asking for, but you don't have to answer everything right now. If you don't know what it's asking about then just skip it and deal with everything after. Once you get it installed and started up, you can install extensions. VS Code does a few things "out of the box", but there are many things it won't and you're supposed to install extensions to support it. And there are tons of extensions. Basically, if you want PHP stuff, you open up the extensions page and type "php" and then install whatever you want. Extensions are a community project so sometimes you'll find there are multiple competing or overlapping extensions and you'll probably have to do a little research to decide which ones you want - if you don't just judge popularity by their download counts. For PHP, the main extension I use is "PHP Intelephense", so that's a good start. For MySQL, it'll depend on what all you want to be able to do, but I bet VS Code has some syntax highlighting built-in so maybe you don't have to install anything more. For Python, it looks like the "Python" extension (by Microsoft) is the main one, potentially "Python Debugger" if you want to do that, and maybe a couple more of the popular ones might be good too. Javascript support is mostly built-in so I don't know if you need any extensions for that - I don't have any and everything works as I want. Docker is... well, too complicated for you right now. Don't worry about it. Basically, it's a way of running things on your computer without having to install them alongside all your other regular software. GitHub is a code storage site: you sign up and they let you upload your code there so it doesn't all have to stay on your computer. Don't worry about that for now either.
  18. It's hard to tell from just that... It seems, at first glance, that the changes are correct: you have something that will force a www redirect but not an HTTPS redirect, but that isn't necessarily wrong. Let's pretend your site is example.com. There are four combinations of names that could work: * http://example.com - should redirect with HTTPS+www * http://www.example.com - should redirect with HTTPS * https://example.com - should redirect with www * https://www.example.com - working site Besides the menu buttons and whatever not working, when you try those four examples, do they work as stated? Does your browser always get redirected to the HTTPS+www site?
  19. Was HTTPS working on your site before it was forced?
  20. Don't overthink the procedure so much and just have it do the absolute most obvious thing: an INSERT statement.
  21. That's right, it wouldn't be - if that was what the Queens Problem actually was. But it isn't, as you missed an important restriction in the puzzle: at most one queen per diagonal. ...but the title says no 2D arrays (a trivial restriction to get around) or recursion or backtracking? If you can do recursion and backtracking then do recursion and backtracking. That's the straightforward solution. Which means you need to think about how to do recursion. Recursion is about breaking the problem down into a tiny example, solving that, and then figuring out how to take that tiny solution and expand it a little bit more. So you should be thinking like this: 1. How can I solve this for a 1x1 grid? 2. How can I take a NxN grid that is valid and place another queen in a valid position using either the N+1 row or N+1 column? You're having a hard time because you're not describing your solution in enough detail. Programming is about telling the computer how to do what you have in mind. But that means you have to have something in mind first. Don't have that and you won't be able to tell the computer anything.
  22. That procedure is wacky. Why is it trying to make a simple INSERT be so complicated? And so prone to not working? The error is telling you, in a weird way that doesn't seem very obvious, that the value you used is not valid. Which it clearly isn't.
  23. But where? How do you decide where to make each move? And how do you make sure you don't make the same set of moves in future attempts? Doesn't that count as backtracking?
  24. Pythagorean theorem? What? Describe the solution you have in mind and we'll figure out how to convert it into code.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.