My database can have several products in one column 'Products' e.g. Product1,Product2,Product3
I've created a webpage where the user can purchase a 2nd product at a discounted price - however the 2nd product must be the same Product as a previously ordered product
I'm just stuck on the last part of the SQL query
Product is the Database Column & @Product is the webpage form checkboxPHP Code:WHERE (CustomerEmail = @CustomerEmail) AND (IsPaid = - 1) AND (Product = @Product)
I want the query to search the database for the customers email where they have paid and the product they have selected matches one they have previously ordered
I've tried
which half works - if there is only one product in the database - it fails if there is more than one productPHP Code:WHERE (CustomerEmail = @CustomerEmail) AND (IsPaid = - 1) AND (Product LIKE @Product)
So i tried
However that give me an error when i compile the project saying there is too many arguements in the getdata queries which contain productPHP Code:WHERE (CustomerEmail = @CustomerEmail) AND (IsPaid = - 1) AND (Product LIKE '%@Product%')
da.GetDataByCustomerEmail(CustomerEmail, Product)
Any idea where im going wrong?




Reply With Quote