Jump to content

requinix

Administrators
  • Content count

    10,138
  • Joined

  • Last visited

  • Days Won

    165

requinix last won the day on September 16

requinix had the most liked content!

Community Reputation

656 Excellent

About requinix

  • Rank
    Impoverished Administrator

Profile Information

  • Gender
    Not Telling
  • Location
    WA

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. requinix

    Accessing data in different formats

    Right. So does that mean your questions are answered?
  2. requinix

    php code problem from command line?

    Does php -m on the command line show that apcu is active? And no, if you installed it then you installed it. You don't need to go grab the sources.
  3. requinix

    php code problem from command line?

    "Not running" doesn't say much. I'm confident the code really is running, and the problem is that it's not doing what you want it to do. We'll start easy: do you have apcu installed and enabled?
  4. If I take your HTML and my Javascript, it works. Is any of the code working? I see you put an HTML comment into the Javascript. You know that's not valid, right?
  5. requinix

    Accessing data in different formats

    A doubly-linked list is good if you have an "array" (list) of data and will need to add and remove somewhere besides at the beginning or end of the list. It's not a very common need. Not sure where you're trying to go with that. The point is simple: in one form you have a set of rows and each row contains columns of data, and in the other form you have a set of columns and each column contains rows of data. The two are mutually exclusive. Which means there is no possible data structure that does both forms implicitly. The best solution would probably be to maintain both forms separately. One data structure with the rows-of-columns, one with the columns-of-rows. You would keep each one updated as data was added or removed. But they would be separate.
  6. requinix

    Accessing data in different formats

    Just with your two examples, you have a row format and a column format. There's no way to cover both formats at the same time in a single representation. Start with a default representation. It could match the original source format, or it could be the most common representation you need to produce, whichever you feel is best. If there's a request for the data in a different format, do the work to produce it. Or if you need performance then keep all formats in memory at the same time. It'll suck for memory usage, and you'll have to update each one when there's new data available, but that's the usual trade-off for increased performance.
  7. It doesn't matter how many columns or tables it has, the approach is the same. Did you see what I did? Understand any of it? Maybe you have a question or two?
  8. These things are normally done best by sorting an internal data table. There's a fair bit I could say so how about an example instead?
  9. requinix

    Please delete/cancel/account my account.

    We try not to delete accounts, especially if they've made any posts - even if they were back in 2007. Here is where I would normally talk about stuff like changing the email address on file, but if you're cleaning up all that anyways then it probably doesn't matter. So then I would follow up with saying that you can just, you know, not use the account anymore... It's not like having it on the books is a bother for us.
  10. requinix

    Count all rows where a field value only appears once

    You want a count of transaction_ids that only have one row each? One inner query that lists all the transaction_ids with one row, then an outer query to count the number of rows inside. To delete, think about what you could do with that same subquery and an IN. Ah, but it's restricted to cases where there's only one row per transaction_id. No ambiguity so it works out.
  11. requinix

    Ajax Insert Bason on Button Value

    1. You took a step backwards with the document.ready. You should not use an onclick with the <button>, so take that back off. Instead you'll use code for it. For the Javascript side, the first line should be just "$(function() {" - using document and .ready is a longer form that you don't actually need to do. No add_to_translog at all. 2. You swapped add_to_basket_submit with main-product-button, but that wasn't the problem. The data you are sending to the PHP script is the data:{action} you have in the Javascript code. Nothing else. Not even the button you clicked. Except your PHP code expects there to be more. If you want to test that the data was submitted then either the use "action" that is in the data being passed, or check that the $_SERVER["REQUEST_METHOD"] is POST. 3. Prepared statements are very important. It's about security and making sure people can't destroy your database. So make sure you take care of it. 4. Now the script is just doing some output without trying to redirect. Keep in mind that AJAX doesn't know whether "Records added" is a good thing or a bad thing. As it is, AJAX is going to think the call worked and you'll get the Hooray message either way. It's possible to indicate to AJAX whether it was good or bad, but for now you can simply use the "response" in the .done callback - like log that message to the console.
  12. requinix

    Ajax Insert Bason on Button Value

    You're on the right track. 1. Messed up the syntax with the $(document).ready stuff. Take another look. 2. There is no "add_to_basket_submit" anywhere in what you're submitting so that check in your code won't work. 3. Never put $_POST values directly into a query. Look at mysqli's prepared statements. 4. The script is being called through AJAX so there's no point trying to make it redirect anywhere.
  13. requinix

    Ajax Insert Bason on Button Value

    You would change the Javascript so that it does the .click using the right selector (where you have the ID now). If that's where the AJAX is going then yes, that is where you would need to put the code to do whatever it needs to do.
  14. requinix

    Ajax Insert Bason on Button Value

    Depends. Do you have multiple buttons? You can't use the same ID for all of them, of course, so you would be forced into something else (like classes). You know you aren't sending any actual data through AJAX yet, right? You kinda need to do that. Probably? We don't know your application. If you have a question about your code then you're in the best position to find the answer.
  15. requinix

    Ajax Insert Bason on Button Value

    It really should be a button, like a <button> or an old-school <input type=button>. It doesn't have to be a submit since you're using AJAX, but if you could if you wanted to (just make sure to cancel the submit event inside your handler). The event handler can know which element triggered the event. What's that code?
×

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.