Ive been messing with this for a while now and as far as i can see everything is correct. The goal is to get the data from another page and then go through the database and delete any row that has the same value that is stored in the field stock. When i run it I dont get any errors but its not deleting it from my database. I verified that it is getting a variable from the other page and that it will compare the variable $stocknum and $stock and should delete the line however it doesnt delete it. Any suggestions or help would be greatly appreciated. Ive searched for a while as to what is preventing it. If anyone sees what im missing or doing incorectly Id thank you for posting.
MySQL isn't compliant with ANSI SQL anyway.. And i think most sql dbms perform an implicit cast anway..
Anyway, you should test if the posted value is really an integer.. Use a regular expression or is_int or whatever floats your boat..
You don't have to iterate over all the rows, and delete them one by one, the query below will delete all the rows that have a value for the stock attribute that equals $somevalue.