Jump to content

maxxd

Gurus
  • Content Count

    940
  • Joined

  • Last visited

  • Days Won

    24

Everything posted by maxxd

  1. Good job - you've figured out the syntax issues with your query (I really do mean that sincerely). Now, before anything else, please look into prepared statements as you're using $_GET variables directly in a MySQL query. Then please google the performance pitfalls of running a 'SELECT * ...' query. As for the coach name, the PHP array from a MySQL query has no idea what table each index of each row in the resultset came from, so the MySQL aliases you set up don't help the PHP output. In other words, the array indexes 'c.coachFirst' and 'c.coachLast' don't exist. The array indexes 'coachtFirst' and 'coachLast' should exist, however.
  2. There are many issues with the code you've posted, but I think it'd be best to start by reconsidering your database structure. Learn about normalization. Once you've got a usable database structure, you can decide if you want to use mysqli (probably not) or PDO (probably), and then learn about prepared statements.
  3. Not gonna lie, I didn't realize attaching a target attribute to a form would do anything at all... There's obviously nothing wrong with your response kicken, but personally (just for readability if nothing else) I'd still seriously consider doing this via AJAX and opening the modal after the processing script returns the data, using a data-{whatever} attribute on the buttons to tell the processing script which logic branch to follow. I have, however, been accused of working harder than I work smart sometimes.
  4. I could well be wrong (as I said I'd just do it via AJAX and open the popup on data return), but I'm not sure you're actually doing what you think you're doing. Check the documentation: https://developer.mozilla.org/en-US/docs/Web/API/Window/open The first parameter to the window.open() call is URL - you're passing 'about:blank' as the URL and sending your form to process.php. Two different addresses, two different actions.
  5. I'd do the data gathering via AJAX, then open the modal window using JavaScript once the AJAX response payload has been delivered. Right now you're sending the form data to process.php while trying to pop open a new window with no actual data attached.
  6. This looks like your browser is set to remember form fields. You don't have a placeholder attribute set on the username field, and password fields don't support placeholder attributes (I think - I'm pretty sure that's true...) so the presence of text in that field is a sign that the culprit isn't what you think it. Delete the form data via your preferences.
  7. What you're looking for is not the way WordPress search works by default. It does a straight string comparison - if the word(s) you typed in the search field are in the title or content of the post (or post type), WP will going to return that post record. Search for an Elastic Search plugin in the plugin directory - I'm pretty sure there are a couple out there.
  8. Also hint: In the long run, using either checkboxes or a multi-select combobox will make your life much easier when dealing with this.
  9. What's in this field? It could just be my own personal naming style but this kinda seems like it would hold the referrer value, which sounds like what you want. So, you may have all the information you need already. Otherwise, do as ginerjm suggests and create an additional hidden field with the value you need.
  10. Honestly, just formatting your code properly is going to help. You've got single-line comments that are (right now) commenting out functionality due to everything being on one line. Put the comments on separate lines or remove them entirely. We'll be able to figure out what your script is doing, I promise.
  11. OK. Now we can safely say the issue is not just in what was originally posted. Format the source code, then post it here again please. It's still unreadable.
  12. gw1500se means in your original post here, not the code itself. Notice the button that looks like '<>' in the editor toolbar - that formats code. The code you posted isn't readable on this forum so please edit it and use the code format.
  13. I don't know what theme or plugin you're using, but there are a couple potential issues with how you're going about things. First, modifying the theme or plugin files directly is not recommended because every time the plugin or theme is updated, your changes will be overwritten. Usually in this type of situation, you'd check the files and documentation for action or filter hooks and use those to make your updates from your functions.php file. Working this way will allow those changes to remain after the plugin or theme updates because the actual theme or plugin files haven't been changed. Another things is - given the name of the static method called (frontSections()) I assume this is calling your installed theme's functions that load the head and/or header templates into the page. These are crucial to the functioning of your site as it creates the top half of the HTML page - I think this is probably why you're seeing the WSOD when you remove this call. So, you know, don't do that. Let us know what you're looking at and what about that you're trying to change, and I'm sure with the brains on this board you'll find the help you need to do what you want and do it correctly.
  14. Do you have control over the building of the link? Because there should be an ampersand before the 'from' variable (not the question mark), and the value of from should be url-encoded. I'm pretty sure this would take care of your issue. If you don't have control then honestly I'm not sure exactly how you'd fix the issue - maybe parse_url()? Not entirely sure what it does with slightly malformed URLs such as yours, but there's a possibility you can use this and ginerjm's explode() suggestion to figure it out, I guess.
  15. I know - I can't stand snake case, but if it's an array key or database *anything*, my fingers just type it that way. Database tables and columns actually make sense to me because I have a tendency to prepend table names with "tbl_". In case I get confused, I guess. But "tbl_student" or "tbl_orders" reads easier to me than "tblStudents" and "tblOrders". And once you've got that established for table names, you might as well keep it going for the column names because then you don't have to think too much or type different patterns in the middle of custom MySQL statements. It makes perfect sense. Really. The array key thing I can't even pretend to explain, it's just something I realized I was doing at some point. I may have been dropped on my head as a child.
  16. I align almost exactly with @kicken except I use snake case for database, table, and column names, and - for whatever random reason - array keys. Couldn't explain the array key preference if I absolutely had to as I really do hate snake case. Unfortunately, I currently work with WordPress so I have see that crap daily...
  17. Yeah, Jason Larke's answer is pretty much exactly what taquitosensei and I have been saying. No. The 'public statements' before the __construct() method are called object properties or object variables. The reason I'm passing in 4 random values is because the constructor signature calls for 4 parameters to be passed in; you've got The first 0 is now assigned to $role, the second is $tag, third is $location, and fourth is $job_id. They're not used in the class you've written, so I passed in nonsense values. There's a bunch of different reasons for having multiple files. The biggest is that AJAX is a client-side technology, but database interaction is a server-side technology. So you need to have the JavaScript file and a PHP file. The JavaScript is separate from the HTML file because if it was all in the same file you'd run a decent chance of breaking the functionality every time you change a DOM element. The PHP is the server-side file that actually gathers the data and prints it back to the AJAX call. Adding the lines above to the jobsDatabase.php file will automatically create an instance of the jobsDatabase class and run the getAllRoles() method of that object, which in turn prints the gathered data. Basically, you're dealing with a whole lot of moving parts with what you're trying to do. Given what we've talked about, I'll recommend again just stubbing in the data - instead of trying to use an additional PHP file to connect to the database and gather the actual data, just make up an array and print it to the AJAX call. In the AJAX success() callback, print that data to screen or console. Once you see the data you're expecting, move on to the next stage - in this case, populating the returned data in the form. From there, worry about actual database interaction. Hopefully at least some of that makes sense - again, it's been a bit of a Monday here.
  18. If that's all the code there is and you're not using a framework, then yes, you need to call the method on the object. Add this to the bottom of your file: $job_data = new jobsDatabase(0,0,0,0); $data = $job_data->getAllRoles(); die($data); Note that anything happening here is dependent on the contents of connect_database.php. While you're learning it may be a little easier to create a static array inside getAllRoles() and output that. That way you know everything is self-contained and you know what you're expecting. This should make it easier to track down any issues and errors in the process.
  19. Did you write jobsDatabase.php yourself? Are you using a framework or library?
  20. Right, and we need to see what the actual JSON string is. If you're using Chrome, select 'More Tools > Developer Tools' from the menu (option - command - uppercase 'i' on a mac, Ctrl + Shift + uppercase 'i' on Windows). You'll see the 'Network' tab along the top - select that, then trigger your ajax call. You'll see 'jobsDatabase.php' under the 'Name' column. Click it, then select the 'Response' tab from the details screen that appears. This will show you the raw JSON output, which may have a slightly more helpful error message.
  21. I just took a look at the code again. I missed the 'method' in your data set - so, yes it's possible that is all being handled behind the scenes and not something you need to worry about. (Sorry - it's Monday in a big way here...) So that begs the question, what does the response show in your browser's devtool's network tab?
  22. From the jQuery documentation: The AJAX call will connect with the script assigned to the url parameter of settings object. In that script is where some action has to take place. For instance, in WordPress you pass a field named 'action' in your dataset to admin-ajax.php. admin-ajax.php then uses the value of that field to know what PHP functions to call in order to get you the data you need. What taquitosensei and I are suggesting is that you add the following to the end of he script - after the closing bracket of your class definition: $job_data = new jobsDatabasee(); $data = $job_data->getAllRoles(); die($data); and change `echo $json` to `return $json` inside the getAllRoles() method. Before you do that however, what does the response header show in your devtool's network tab after the AJAX call has been made?
  23. What taquitosensei just posted is what I was talking about. Ajax is connecting to the file jobsDatabase.php and will parse that file. But if there's no action in the script (like instantiating the object and calling the getallRoles() method), nothing will happen.
  24. Couple questions here, but the big one is this: you are calling the jobsDatabase::getAllRoles() method, right? In your ajax target script (../../../components/jobsDatabase.php) you instantiate a jobsDatabase object, then call getAllRoles() on that object, right? If so, then yes, it might make more sense to return from the method instead of directly outputting (you'd have to dump the returned value from the instantiated object). At this point var_dump() $json after your while loop and check the network tab of your browser's developer's tools to see what the output is. If you're not doing that, then that would be the problem - you're never going to get data from a method you don't call inside and object you don't instantiate.
  25. The email files are located in the woocommerce/templates/emails directory - I believe you're looking for the customer-processing-order.php file. Don't change the files in the plugin directory, though, or any changes you make will be overwritten next time the plugin updates. Create a /woocommerce directory in the root of your theme. Inside that, match the directory structure of the plugin's templates directory and copy the file there, then make changes to that version. In other words, copy /plugins/woocommerce/templates/emails/customer-processing-order.php file to /your-theme/woocommerce/emails/customer-processing-order.php. Make the change in the version that's in your theme directory.
×
×
  • 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.