Question

I ran the query:

  $stmt = $dbh->prepare("DELETE * FROM `1_cart_items` WHERE `forid`=?");
  $stmt->bindValue(1,$_SESSION['name'],PDO::PARAM_INT);
  $stmt->execute();

and I've appeared to delete the entire table, what have I done wrong that has caused this problem?

Was it helpful?

Solution

Quite a short answer: no, your query did not cause your problem. Your query would have failed, as already said in the comments. The * will break the query, preventing it from deleting anything. Your problem must have originated somewhere else.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top