سؤال

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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top