My problem is that whatever symbol I write in sell_form.php even if it doesn't exist in portfolio table, the query retursn true. Here's the query in sell.php enter image description here

and that's sell_form.php

 <form action = "sell.php" method = "post" >
     <input class="form-control" type = "text" name = "symbol"/>
     <input class="btn btn-default" type = "submit" placeholder = "sell"/>

The if ($row === false) syntax is used for queries that do not return rows, like an UPDATE or INSERT query. Review the Walkthrough -> login section of the instructions (pages 16-17). This statement is key:

an empty array is == to false because of implicit casting

Since you are testing for an empty array, you need to use if ($row == false) syntax. You could also use if (empty($row)). This may make your intention clearer.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .