MySQL instruction is not working

I am using the SQL/PHP interface with the following instruction successfully:

SELECT col1,col2 FROM table_name\n WHERE col2 LIKE %(tagTextBoxText)%

but get an error with this instruction:

SELECT COUNT(column_name) FROM table_name WHERE col2 LIKE %(tagTextBoxText)%

"Error 400, Wrong SQL, FUNCTIOn android.COUNT does not exist. Check the 'Function Name Parsing and Resolution' Section in the Reference Manual256)

I just want to count the number of results from the first instruction. What can I do? Thanks in advance for any help...

requires a column_name - like Product, Price, ID

Do you columns have names..?

Thank you for the response. Of course do I use a column_name, the same as I am using in the functioning instruction. (All of the columns have names.)

Try using column names:

SELECT COUNT(*) FROM Products WHERE ProductName LIKE '%syr%';

are you talking about MySQL and this tutorial?

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Yes, I am talking about MySQL and mysql.php. I should mention, that I started with only one SQL instruction in the app, and it worked (as I told you before). Now I added the second instruction with the SELECT COUNT before the other SELECT and I get the error. I attached the required block imag


You will need to run the second query after the first query has completed (Web1.GotText).

1 Like

Thank you 'TIMAI2, I separated the second SELECT from the run query into a "When Web1 Got Text", but I get 2 errors with suggestions: "get/set Response Code". What should I do in details??

I usually set a variable for each different call when making multiple calls to the same web component, then test for the value of the variable in an if/elseif statement in Web1.GotText.

You could also introduce a second web component to handle the second query

I replaced the original SELECt from the block and used only the new SELECT with the COUNT instruction. I still get the error message, that "Function android.COUNT does not exist..." as already above mentioned.

please provide a screenshot of your updated blocks

Here follows the screenshot:

Is that a space I see between COUNT and (rName) in the SELECT query?

That's a syntax killer.

Thank you ABG, there was a space between!!! I deleted it, and the instruction works. Now I will try the 2nd instruction in combination

The combination of both instruction also works, but not properly...(no error message, but the second message of the SELECT is too fast and overwrites the first result too quickly. I will try one of the suggestions of TIMAI2, but you've lost me now....Perhaps I use the clock in between the 2 instructions?

what about using 2 different labels to display the result?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.