For example, when searching string_1 in MySQL table found NO RESULT, then want to add string_1 into database table. Using code below:

while (res->next())
 cout<<"This word means "<<res->getString(2);
 if (res==0)/[U]/I use this if statement , but don’t work![/U]
 {
     cout<<"Would you like to add this word to database?"<<endl;
 }

What should I do?help

>>hat should I do?help~~~~
Create the INSERT sql statement. For example: INSERT INTO table1(name) VALUES("data") If that doesn't make much sence to you then you probably need to study SQL language (tutorial here)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.