0

I need to insert some data into a mysql database. Db is connected and working. I am running the following code :

a = sprintf('%s',hashedStr); 
sqlQueryStr = 'insert into products (security_code) values (a)'
QueryDB(sqlQueryStr);

I have a database called test and a table named products with 2 fields id and security_code.

When I run this, I get :

Unknown column 'a' in fieldlist ...

Why is this happening ? i dont have and dont need this column ...

Any help ?

1 Answer 1

1

Try with:

sqlQueryStr = sprintf('insert into products (security_code) values ("%s")',hashedStr); 
QueryDB(sqlQueryStr);

problem is that you are not replacing "a" variable into sql expression

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.