Basic quest code in PHP
I don't understand the need for two queries.  They seem to be retrieving the same exact result set, so why query twice?



Your code is difficult to read because of the inconsistent indentation and the inconsistent way in which you render your HTML output (sometimes dropping out of PHP, sometimes echoing out of PHP, for more or less that same type of use case).
 I would also encourage you to get better with overall style consistency.  Variable names are not very meaningful (querya/queryb). Spacing around operators is inconsistent. Spacing around parenthesis is inconsistent.  Use an IDE that allows you to enforce a styleguide and stick with it.



The nesting in your while loop is a bit out of control. You should think about inverting conditionals and/or using continue to clean up these nested conditionals.  Consider how much easier it is to read code like this:

&lt;?php 
while ( $findquetes = $querya-&gt;fetch() ) {
    if ($queryb-&gt;fetchColumn() &lt;= 0) {
?&gt;
&lt;button
    class="peter-river-flat-button"
    style="border-radius:6px; padding-left:45px; padding-right:45px;" 
    onclick="window.location.href='../quete/vigier.php'"
&gt;Quête - Le Vigier (Disponible)&lt;/button&gt;
&lt;?php
        continue;
    }
    if ($findquetes["comp_quetej"] &lt;= 0) {
        continue;
    }
    if ($findquetes["comp_quetej"] &lt; 1) {
?&gt;
&lt;button disabled class="pomegranate-flat-button"
    style=" border-radius:6px; font-size:15px; padding-left:45px; padding-right:45px;"&gt;Quest - Quest 1 (Ongoing)&lt;/button&gt;
&lt;?php
        continue;
    }
    if($findquetes["recomp_quetej"] &lt;= 0) {
        continue;
    }
    if ($findquetes["recomp_quetej"] &lt; 1) {
?&gt;
&lt;form action="" method="POST"&gt;
    &lt;input type="submit" class="peter-river-flat-button"
        style=" border-radius:6px; font-size:15px; padding-left:45px; padding-right:45px;"
        value="Quest - Quest 1 (Confirm the quest)" name="confirmerquete"&gt;&lt;/form&gt;
&lt;?php
        continue;       
    }
?&gt;
&lt;button class="emerald-flat-button"
    style=" border-radius:6px; font-size:15px; padding-left:45px; padding-right:45px;"&gt;Quest- Quest1 (Finished)&lt;/button&gt;';
&lt;?php
}


Now, the code path is much more clear, and having done your conditionals this way, you can clearly see what might be problematic conditional logic in your current approach (what happens with certain values between 0 and 1?). What I have shown above obviously still needs to be cleaned up to the point where the design intent is made clear.  The general philosophical approach should be to make quick exits from functions/loops, etc. to enable you to de-nest your happy path code.  Also note that there are very few times where you really need an else condition.  If you have written an else, you may want to revisit your condition to see if there is a better way.

Note that you should also de-nest your very last conditional.  You have ~15 lines of code inside a conditional when it doesn't need to be.



Why so much inline styling?  If you have class names being used, why are these styles not attached to the classes in external CSS? This certainly makes code harder to read the way you have it. This along with perhaps getting to a better approach for templating your display code would server you well in getting to a higher quality code base.




onclick="window.location.href='../quete/vigier.php'"



Do you really need this in javascript as opposed to setting form's action or using a simple &lt;a&gt; styled similarly to button?

If you really need to apply javascript here, consider moving away from in-line usage.  Over time you will begin to realize that separation of application display and behavior code allows for a tremendous amount of code re-use.  Consider putting this in document.ready handler and applying it to element based on class or id.



You should be able to combine you to update queries against users table into a single query.



I don't know what DB class you are using, but it is unclear how you handle unexpected database interactions.  What happens is prepare fails? What happens if execution fails?  Are there any possible exceptions you should be catching or error handling that should be in place?  You code seem to really only consider "happy path".



I find it odd to have all you POST logic crammed way down at the bottom of the script after the point where you have already rendered output to the browser. Ideally, if you have a script which have different GET and POST logic, you would handle all the database interactions up front and make it much clearer earlier in the script whether the code is relevant to GET or POST.



Why would $findquetes be part of the conditional criteria for this POST logic?  This variable may or may not even be populated with a record.