Hi so i want to make it so that the option whether its vegetarian or meat decides which table it will insert into. Please help. So like basically:
------------------------------------------------------------------------------------
if user input pcategory == Vegetarian_products then
insert blah blah blah into tableforvegetarian
else
insert blah blah blah into tableformeat
endif
-------------------------------------------------------------------------------------
You have the same problem with your query as you did in the other post. That first needs to be corrected. So the first step is to have the SQL query successfully insert into the db. I would also argue that you need to make sure that your queries are not susceptible to SQL injection. Like I said in the other thread mysqli alone does not guard against SQL injection.
I didn’t need to change anything about the string being written differently. As i said it was just a problem with mamp. I think i did some stuff in privileges that didn’t allow me to insert the data. Also trust me you don’t need to worry about SQL injection as it is not required in the project. We just have to make a simple site that will never be published. Just the main structure is neccessary. So yea I just wanted to know how to make from the the two options that the user is given (vegetarian/meat products) an if statement to seperate between them and place them in different database tables.
if ( condition ) {
commands to do if the condition proves true ;
}
elseif ( optional alternative condition ) {
commands if the previous condition proves false but this one is true;
any number more of these ;
}
else {
optional commands only for when none of the above conditions prove true ;
}