Jump to content

requinix

Administrators
  • Posts

    15,067
  • Joined

  • Last visited

  • Days Won

    414

Everything posted by requinix

  1. By understanding what the mysqli code you have now does, understanding how PDO works, and then translating between the two. It's like translating between two spoken languages (but considerably easier): you hear what someone says, you understand what they're saying, and then you repeat their thoughts using different words. $queryres=mysqli_query($myConnection,$querysl); $pagerow=mysqli_num_rows($queryres); $pagedata=mysqli_fetch_assoc($queryres); That runs a query, gets the number of rows it returned, and fetches the (first) row from the results. See what PDO offers to do that.
  2. That's JSON. Can I assume you've already json_decode-d it? Here's how to read that output: { The value you get back from json_decode represents an object. If you decoded it as an object (the default behavior) then you will have PHP objects to work with; if you told it to decode to associative arrays then the JSON objects will be PHP arrays. To get to the price, status, and name, first you have to get to "usedOffers": [ the usedOffers list. That means you need ->usedOffers or ["usedOffers"] on whatever variable you're using for the decoded JSON. The [ means this value will be an array. Since there are multiple items in this array, you need a foreach to get the next thing to work with. Each of those { will be an object (or associative array). The price is immediately available from there. For the condition status, you continue from there by getting "condition": { the condition, which is also an object (or associative array), and from that you can get the status. Similarly, the name is under the "seller" object. If you have trouble, post your code and describe both what you expected to happen as well as what actually happened.
  3. If you're on Ubuntu then do not edit INI files yourself. As most other major distros do too, Ubuntu will set everything up automatically for you. Undo all of your manual changes, including where you added that extension=openssl line, then install the php-openssl package (using apt).
  4. Where's the rest of it? The rest of the HTML and the rest of the CSS?
  5. Because as the first two words of that output show, those are warning messages - not exceptions. Which suggests that you didn't include in your own code the set_error_handler code that blog post demonstrated. Which, by the way, would throw an ErrorException and not an EngineException. And speaking of, there is no such thing as "EngineException". PHP 7+ converted some things into exceptions. Not all things.
  6. Taking for granted who is writing a web app? Is it someone other than the person who started this thread? What? Really? PHP can do other things than serve websites? I had no idea! ๐Ÿ™„ So if this isn't for a website then would you kindly explain what this is all about?
  7. Strider is probably on the right subject. URLs don't have to match files. You can have a file named "whatever.php" and show it in a URL as "whatever" - or anything else you want. So keep the file extension, and if you want your URLs to look a certain way then make the URLs look the certain way.
  8. confirm() will present a browser dialog with a "confirm" button (eg, Confirm or Yes) and a "cancel" button (eg. Decline or No or Cancel).
  9. You're saying that you don't believe programmers should be using file extensions?
  10. Without a file extension, your system has to guess what type of file it is based on the data. Apparently, it guessed "map-path". And your PHP Editor doesn't know what to do with "map-path" files. Give your PHP files the .php extension. It's what you're supposed to do.
  11. preg_match_all returns the number of matches. Come back next week when your head has cooled off. Or don't.
  12. Did you check the link I gave? It pointed you to the Return Values section (or at least it was supposed to).
  13. If it works in one file and not in another then you likely have some sort of problem with variables. Namely, that $txt one. Side note: don't count the matches like that.
  14. Once again: I'll even point you in the direction of using RewriteCond to perform that check.
  15. There are no duplicates in that output either. Look at the Grader column: every value is different. That means every row is different. You need to describe what data you want to get with a query. What rows do you want? What values do you want? What rows and values do you not want?
  16. A height of 100% fills to the parent's height. If you want the full height of the viewport then (a) make sure the parent element - and its ancestors - are the full height as well, or better yet (b) don't use percentages and use actual meaningful units like vh.
  17. I don't see any duplicate rows in that output. 1. What data do you have in the tables? 2. What is the query you are executing? 3. What results do you want to get, and why?
  18. The way they do it is they give the user something to connect to that supports only IPv4, and then another that supports only IPv6. Then they combine the information together to give you the full results. Because all you can ever get from the user is how they connected to your site. If they used IPv4 then you can't know what their (public) IPv6 address is.
  19. What will your code do if there aren't any rows from the query? (I know the answer - I want you to read through it and think about what will happen)
  20. Given that the CSS you wrote is invalid and what you're trying to do isn't supported, Either restructure your HTML so that the input and your <p> are sibling elements, thus allowing you to use ~ or +, or use Javascript to apply a CSS class somewhere useful or to show/hide the paragraph element itself.
  21. Let me put it this way: you can't use Javascript to show or hide something without also using CSS.
  22. That describes the "ListDevicesDB" API you can call. 1. It uses the GET method. 2. You need to include a "token" header that includes some value. If the value is what you included in your post then that needs to change because this was (probably) supposed to be a secret value and you've now shared it with the whole internet. 3. The URL is as given there. It optionally supports a "deviceSerial" query string parameter, as the description indicates. 4. It doesn't describe what the return value is. So you need to get a basic API calling thing in place. You can use libraries for it, or you can write the API calls yourself using cURL. Your first step should be to understand more about making API calls through PHP. It's all the same everywhere - only differences being exactly what the API wants, and that's the information they gave you. Once you understand a little more about API calls, then you can deal with the PHP code to try to make them. It's pretty simple but you do need to know more about what this is all about to be effective at it.
  23. Are you sure you edited the right file? Did you restart Apache to pick up the changes?
  24. Use XSRF tokens to prevent people from submitting forms unless they are the user themselves, and use a reputable CAPTCHA service to (try to) prevent bots from using your form.
×
×
  • 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.