Updated:

The basic shape

/execute as @a at @s if block ~ ~-1 ~ minecraft:gold_block run effect give @s minecraft:speed 1 1
PartMeaning
as @aRun as each player
at @sRun at that player's position
if block ~ ~-1 ~ gold_blockContinue only if the block below is gold
run …The command to run

This gives Speed to anyone standing on a gold block.

Mistake 1: no run

/execute as @a at @s say hello is an error; the command must follow run. On Java, an execute that ends with a condition and no run just reports "Test passed" or "Test failed", which is handy for checking a condition.

Mistake 2: expecting as to move the position

as changes only the runner. In a command block, /execute as @a run setblock ~ ~-1 ~ stone places stone under the block again and again, not under each player.

FormRunnerPosition
as @a runEach playerUnchanged
at @a runUnchangedEach player
as @a at @s runEach playerEach player

More in execute as vs at.

Mistake 3: old Bedrock syntax

Bedrock switched to the Java-style syntax in 1.19.50. Old commands like /execute @a ~ ~ ~ detect ~ ~-1 ~ gold_block 0 effect @s speed need rewriting:

/execute as @a at @s if block ~ ~-1 ~ gold_block run effect @s speed 1 1

Mistake 4: conditions

No error, but nothing happens

If as selects nobody, execute stops silently. Test one step at a time:

# 1. Is anyone selected?
/execute as @a at @s run say selected
# 2. Add the condition
/execute as @a at @s if block ~ ~-1 ~ minecraft:gold_block run say condition true

If a name appears in chat, everything up to that point works. See target selectors when nobody is found.

Common questions

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.