Jump to content


  • Content count

  • Joined

  • Last visited

Everything posted by justsomeguy

  1. Cron job stopped working

    I don't know what GoDaddy allows, my servers let me email the output of a cron job if there is any (which would be the only reason to have PHP display error messages from a cron job). Check with GoDaddy to see what your options are.
  2. Cron job stopped working

    Well, maybe you're using parts of PHP that only work in a web server and not when you just run the file directly on the command line. Maybe there are any number of possible runtime errors. I don't know, I haven't seen the code you're trying to run. It's not going to do any good to have it display error messages when you're not running the file yourself. Make it use an error log, make sure PHP has write access to the error log, and check the error log after the cron job runs. If you think the actual problem is cron, and not your PHP code, then your server is fundamentally broken in such a way that something as basic as cron doesn't even work and you need to reinstall Linux. I bet that has nothing to do with it though, and that the problem is your PHP code.
  3. State/Country Form Fields

    You can put an event listener on the state field to check for things that might match a country and auto-select the matching option if you want to do that. You'll need to have an array or something or states and countries so you can match them up.
  4. Cron job stopped working

    I imagine the actual cron job is still running to execute that code, so you need to debug the code that it's running. Make sure that PHP script is using an error log that you can check for error messages to look for problems when it ran. Make sure you also test that code to make sure it does what you think it does. Ideally you would run that actual command in the shell.
  5. serialzing a form

    Why only submit part of them? Why not submit everything and figure out on the server what changed?
  6. if not working in for loops

    if (i = j) { That assigns the value of j to i, and then tests the value of i, it does not compare i and j to see if they're equal. Check the page on operators to look at the different operators you can use.
  7. Error 500 - Probable Causes

    That's a parse or syntax error, when that happens only the settings in php.ini will apply. When there is a parse error it can't determine the structure of the code so it doesn't execute anything at all, including any commands to set error reporting or other options, so it uses the settings in php.ini.
  8. intelligent 4 track balance handler

    It sounds like, for browsers that support it, when you control one item in a media group it will control all of them, but that probably also means volume, it means you wouldn't be able to set different volumes for each item. This may help, this is part of a wrapper for media objects where you can nest them inside each other, so you could have 4 audio items nested into one item that can control for playback, but probably still change the volume of each individual item. https://github.com/brianchirls/popcorn-inception
  9. search query done... i think?

    The column name is not users_fornavn, it is "any_value(users.users_fornavn)". You can use print_r to print out the entire array to see what's in it. You can use an alias to change the column name in the result. Wouldn't it make more sense to disable the SQL mode causing that error? https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html
  10. Action to Run JS Validation AND PHP Script

    A form only has one action in the attribute. You can attach a submit event handler to run before the form gets submitted, but that doesn't go in the action. The action should be the PHP script you want to process the form, and you can use Javascript to attach a validation handler. Make sure to also validate the form with PHP, Javascript validation is only a convenience for the user, you shouldn't rely on it.
  11. Using document.cookie

    No, the PHP session is not available to Javascript, and Javascript cannot modify the PHP session.
  12. Seriously, when people suggest learning and using prepared statements that's not really an idle suggestion. Your code won't work if people enter certain characters on the form, and it's vulnerable to attack. If you want to continue learning the bad way to use a database, and write code that contains the #1 attack vector used to attack websites, so that later you have to forget all of that and re-learn the right way that's up to you, but it seems like it makes sense to just learn the right way to start with.
  13. Class Variable Declaration

    I don't know what you're asking for. Like I said, variables do not get declared in PHP, only defined and used, and I don't see any issues in your code other than what I described above. The only edit I would make would be to remove the loops and fetch the result set all at once with the built-in methods. e.g.: $sql = "SELECT letter_no, letter_title, letter_abstract FROM sevengates_letter WHERE letter_no = ?"; $mysqli_stmt = $this->mysqli_obj->stmt_init(); $mysqli_stmt->prepare($sql); $mysqli_stmt->bind_param('i', $next_letter_no); $mysqli_stmt->execute(); $result = $mysqli_stmt->get_result(); $return = $result->fetch_all(MYSQLI_ASSOC); Now $return has the entire result set, organized as an associative array. You don't need to use a single loop. Although it would be good practice to add error checking to that code as well.
  14. Class Variable Declaration

    You don't have to declare variables in PHP, at least not like you do in other languages where you declare a variable as a certain type before you use it. PHP variables only need a value if you're using them, so you can either initialize them with an initial value, like an empty array if the variable is going to be an array, or just set them to their value to start with before you refer to them elsewhere. The only way that PHP really has to declare a variable is with the class properties. On another note, you use a lot of code to do some simple stuff here. One issue is that you keep referring to a variable called $row that doesn't exist. Another issue is that it looks like you have several lines of code which include multiple loops and calls to result_metadata, fetch_field, call_user_func_array, etc, which can all be replaced by a single call to fetch_all. I don't see why you're doing it the long way when there's a single function to do that. It seems unnecessarily complex and time-consuming.
  15. intelligent 4 track balance handler

    I guess I would start with the HTML audio elements, just getting multiple things to play at the same time. Once I did that, you're probably talking about setting up a canvas or something to have your graphics on it, so you could look into the canvas and adding your images or whatever you want to that. For the drag and drop on the canvas, if you can get the position of the dragged object then you should be able to use some basic trigonometry to figure out the pixel distance between the object and the four corners, and set some scale for volume for each of them however you want that to scale.
  16. Class Variable Declaration

    If it's an actual class property variable then you declare those before the constructor along with their visibility - public, protected, or private. If you're talking about variables that you just use locally in some function, you treat them like any other variable in any other piece of code.
  17. appml broken?

    It looks like they removed that section of their site, I'm not sure why. You may be able to email support@w3schools.com or one of the other contact links you can find on the site to see about getting a copy. I guess that's a cautionary tale about relying on external resources instead of saving them and using them locally.
  18. Tutorials

    Programming exercises are fine, videos I don't think would help because programming is not that kind of activity. You need to understand what you're doing, in your mind, it's not just a series of movements you can copy. Step 1: hire several hundred designers, programmers, and testers so that you can have at least a hope of finishing a project like that within a year or so. "How to Build Facebook" is a business management class, not a programming class. I am going to defiantly say that W3schools will definitely not be teaching people how to create enormous websites. They are trying to teach the fundamentals that you can use to build things, not try to teach how to build some single specific project. You can have an event listeners for mouse right clicks to cancel the default and show your own structure, but not all browsers support that or have it enabled by default.
  19. No access to CSS

    That's the real problem. The problem isn't that things like HTML and CSS are changing, it's that you're limited because you can't change the CSS. The third party company should allow a stylesheet that only is used for the articles that need it.
  20. Using document.cookie

    The path part of a URL starts after the domain name. When the path is just "/" it means to send it to any path. If you made the path, for example, "/admin", then the cookie would only be sent to any request under "domain.com/admin".
  21. Using document.cookie

    When you set a cookie you can specify a path for it, and the browser will send it to any request under that path. So you can specify that cookies should only be sent for a certain directory, for example.
  22. How to delete a record

    If you need help with your code, we'll need to see the actual code you're using for the delete page.
  23. Php.ini file?

    That's not true. There's one way you can do it using the mail function and setting default values for various things in php.ini, but that's not the only way that PHP can send email. You could use a library like PHPMailer to give you a lot of features pretty easily, for example. The regular mail function can be a little difficult to use in some situations. You shouldn't need more than one database, there aren't a lot of limitations on a database that would mean you need a second one.
  24. user login verification + condition

    That doesn't matter, you can use prepared statements with any kind of query. You use a prepared statement any time you are putting data into the query. You should never just put a PHP variable in a query like this: $query = " SELECT username, password, title FROM $testTable WHERE username = '$testUsername' AND password = '$testPassword'"; That's a major attack vector for websites. With that in your code, I could enter a username and password which will always log me in without needing to match any username or password in the database. If I know the username, like "admin", then I can log in as that user without needing to know their password. All of that because you are using PHP variables inside the SQL query. Replace the data with placeholders, use a prepared statement to bind your variables, and you won't have that problem. $query = " SELECT username, password, title FROM $testTable WHERE username = :username AND password = :password";
  25. insert (XML DML)

    When you use insert ... into, you're telling it to make it a child of the node you refer to. According to the documentation, you can also tell it to be the first or last node of a list, or before or after a given node. So you probably need to identify the last node and then tell it you want to insert before that one. https://docs.microsoft.com/en-us/sql/t-sql/xml/insert-xml-dml