PHP PDO Display a single record

Asked

Viewed 67 times

1

Hello. I have a popup system where the client chooses which one will appear on the home. If one is already selected he cannot select another. You have to uncheck the asset and mark what it wants. I want to know how to place a warning message, warning him that you already have an asset.

Follows the code:

$stmt = $PDO->prepare("SELECT * FROM comunicados"); 
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_OBJ);

if($stmt->rowCount() > 1 ):
    echo "erro";
else:
// codigo se tudo estiver ok
endif;
  • Dear Betinho if it is what the person selected then neither should come from the bank but from an HTTP request (form), if it is to prevent something then have pq save in the bank.

  • is coming from the bank... via control panel. Look at this image... https://i.ibb.co/Cqrzw6c/Annotate-o-2019-04-22-090111.png

  • So the use of bank does not make sense there, could be solved via Javascript on the front end, BUT dependent on what you did, because this is a printscreen, there is no way to know what you did and so there is no way I am kicking answers here. I recommend you edit your question and explain better what you already have.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.