Hey guys, i am having a problem in my query statement. I am using Mysql in Netbeans and c++. Really Hope for some help. I posted it here as i read up a bit on it and it seems the solution is based on c++.
What i am trying to do is for the user to enter a certain value and then the program will store the value into the database...
string NewMovie ;
Cout <<" Enter your new movie : " << endl ;
cin << NewMovie ;
Basically, the person will enter a new movie(in this case Avatar) and the input will be saved to a string called NewMovie.
Here is when my problem starts...How do i input this variable into an insert sql statement. I checked my statement and i tried hardcoding my data like this...
mysql_query(conn,"INSERT INTO movie_info (movie_title , values ('Avatar')" );
The database will be updated.
But if im using a variable called NewMovie, i cant just insert it into the statement as it will not read the value of NewMovie. S
What can i do to solve this problem so the sql statement can read the variable and then save it into the database.
I read up Cstring and ostreamstring but i do not get how they are used. Could somwbody show me how they are being used based on the example i gave, or if not, show me another way on how this problem can be solved