title: Insert data in table after verifying username and password
body: <p>I have a php file which retrieves 4 parameters: username,password,barcode,count.
  I want to INSERT the username barcode and count into a table "users_products" after checking if the username and password matches each other (from another table "users")</p>
  
  <p>So the code would be something like:</p>
  
  <p><code>IF EXISTS(SELECT * FROM users WHERE username = $username AND password = $password) THEN
  INSERT INTO users_products (username, barcode, count) VALUES ('username','barcode','count');</code></p>
  
  <p>This code is not working, this isnt even real syntax i guess, but i think everybody understands what i want. Thanks for every help.</p>