-
Posts
24,566 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
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)
-
Unable to save submitted data in a MySQL database using PHP
Barand replied to Johngm's topic in PHP Coding Help
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? -
Unable to save submitted data in a MySQL database using PHP
Barand replied to Johngm's topic in PHP Coding Help
If you post something, readable there's a chance someone might read it. -
Column and table identifiers should not be in quotes. Only string literals should be quoted. Remove the single quotes from the query.
-
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
-
you're I'll take that as an admission of deliberate time-wasting
-
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/
-
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input/checkbox
-
... the one @ginerjm told you to set
-
For increased readability, use them between <pre>..</pre> tags E.G. echo '<pre>' . print_r($_SERVER, true) . '</pre>';
-
How to user insert... select... with my two tables based on id?
Barand replied to Max45's topic in MySQL Help
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. -
The sooner you learn where to find the PHP reference manual, the better. Start with the basics
-
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 | +----------+----------+----------+
-
What is this doing ... REPLACE(REPLACE(REPLACE(REPLACE(value, '- $', ''), '75.00', ''),'90.00',''),'100.00','') What's the data that requires a quad-replace?
-
I just didn't see the table - the end of that first line was somewhere in my neighbour's living room.
-
So that they can jump in their time machines and go back to login correctly?
-
Messaging/Chat System - Directing messages to more than one recipient
Barand replied to mongoose00318's topic in MySQL Help
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] ); -
Very little resemblance to the examples I gave you. Why did I bother?
-
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
-
You'll stand a better chance of doing that if it is one of the tables in the query.
-
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.
-
-
if you view the page source, what does it look like?
-
CURL PHP Crawler Returns Access Denied Error
Barand replied to Geoffism00's topic in PHP Coding Help
Not surprised, browsed to the page and got put in a holding queue.