Jump to content

Barand

Moderators
  • Posts

    24,566
  • Joined

  • Last visited

  • Days Won

    822

Everything posted by Barand

  1. I find it difficult to believe that either of those code snippets work. If you are using fetchColumn() the total that you want will be in $t_votes. (It will not be an array, just the value from the fetched column)
  2. Normally, when someone posts a large amount of code, I'll copy and paste it into my code editor and check for errors and, in this case, search for the SQL bits. Tell me how to do that with a picture of the code. It's further obfuscated as all the database activity seems to happen inside the $db object EG so there is no way we can even see the query that is being executed or what may be happening. Are there any error messages? Are you even checking for errors? Have you checked the error log?
  3. If you post something, readable there's a chance someone might read it.
  4. Column and table identifiers should not be in quotes. Only string literals should be quoted. Remove the single quotes from the query.
  5. Might I suggest $tools = [ 'good' => [ 'qty' => 3, 'price' => 10.00 ], 'broken' => [ 'qty' => 3, 'price' => 5.00 ] ]; foreach ($tools as $condition => $data) { printf("We have %d %s tools at \$%0.2f each<br>", $data['qty'], $condition, $data['price']); } Gives We have 3 good tools at $10.00 each We have 3 broken tools at $5.00 each
  6. you're I'll take that as an admission of deliberate time-wasting
  7. Jeez!. The additional code you need to add is checked You might find a basic adult literacy course here https://manadulted.org.uk/our-courses/esol/
  8. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input/checkbox
  9. ... the one @ginerjm told you to set
  10. For increased readability, use them between <pre>..</pre> tags E.G. echo '<pre>' . print_r($_SERVER, true) . '</pre>';
  11. Table "addfriend" should contain (userid, friendid) only - no name. Don't bother. Problem solved. Also, having a row with just a name will not tell you whose friend it is. For future reference, "didn't work" tells us absolutely nothing about your problem. And just posting a query that "doesn't work" only tells us what you don't want to do, not what you are trying to do.
  12. The sooner you learn where to find the PHP reference manual, the better. Start with the basics
  13. Does this do it for you? wp_wpforms_entry_fields: +----------+----------+--------------------+ | entry_id | field_id | value | +----------+----------+--------------------+ | 1 | 5 | Laura Norder | | 1 | 13 | School A | | 1 | 16 | Belt 1 | | 1 | 18 | Sparring - $75.00 | | 2 | 5 | Peter Dowt | | 2 | 13 | School B | | 2 | 16 | Belt 2 | | 2 | 18 | Sparring - $90.00 | | 2 | 43 | Belt 3 | | 3 | 5 | Tom Dicanari | | 3 | 13 | School C | | 3 | 16 | mmm | | 3 | 18 | Soarring - $100.00 | | 3 | 43 | kkk | | 4 | 5 | Joe King | | 4 | 13 | School D | | 4 | 16 | Belt 4 | | 4 | 18 | Sparring - $150.00 | | 4 | 43 | sss | +----------+----------+--------------------+ mysql> SELECT entry_id -> , field_id -> , CASE field_id -> WHEN 5 THEN CONCAT(SUBSTRING_INDEX(value, ' ',1), ' ', LEFT(SUBSTRING_INDEX(value,' ', -1), 1)) -> WHEN 18 THEN TRIM(SUBSTRING_INDEX(value, '-', 1)) -> ELSE value -> END as value -> FROM wp_wpforms_entry_fields -> WHERE field_id IN (5, 13, 16, 18) -> ORDER BY entry_id; Query results: +----------+----------+----------+ | entry_id | field_id | value | +----------+----------+----------+ | 1 | 5 | Laura N | | 1 | 13 | School A | | 1 | 16 | Belt 1 | | 1 | 18 | Sparring | | 2 | 5 | Peter D | | 2 | 13 | School B | | 2 | 16 | Belt 2 | | 2 | 18 | Sparring | | 3 | 5 | Tom D | | 3 | 13 | School C | | 3 | 16 | mmm | | 3 | 18 | Soarring | | 4 | 5 | Joe K | | 4 | 13 | School D | | 4 | 16 | Belt 4 | | 4 | 18 | Sparring | +----------+----------+----------+
  14. What is this doing ... REPLACE(REPLACE(REPLACE(REPLACE(value, '- &#36;', ''), '75.00', ''),'90.00',''),'100.00','') What's the data that requires a quad-replace?
  15. Puzzled - what it is it supposed to do? It doesn't reference anything from the query nor does it reference any classes.
  16. I just didn't see the table - the end of that first line was somewhere in my neighbour's living room.
  17. So that they can jump in their time machines and go back to login correctly?
  18. The purpose of a prepare() is to separate the query from the input data.. You therefore need WHERE msg.order_id = ? then provide the data in an array of parameters when you execute $statement->execute( [$orderid] );
  19. Very little resemblance to the examples I gave you. Why did I bother?
  20. I am not talking about the mydloader.php page. I … am ... talking … about … the … page … that … contains … the ... link/image … that … you … are … clicking … on
  21. You'll stand a better chance of doing that if it is one of the tables in the query.
  22. View the page HTML source of the page containing the link that your php code created. When that page is displayed in your browser, select "View source" to see what the html is for that link.
  23. if you view the page source, what does it look like?
  24. Not surprised, browsed to the page and got put in a holding queue.
×
×
  • 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.