I want to insert information in a table in my db (view METHODE 1 insert_info())
In my code below I want to give the variable nom_journal the value same_path [nom_journal=same_path] that I returned in the second method (METHODE 2 (same_path).
I tried to give the variable nom_journal the name of the function cause it returned a string but it doesn't work. It gives me the following error
no matching function for call to 'Journal::find_nom_journal()'
*****METHODE 1 : *****
void Journal::insert_info()
{
Db_response::ConnectionFunction();
//Variables
int id_journal= getId_journal();
string nom_journal = find_nom_journal(); // --> THIS IS THE ERROR
string s_id_journal(to_string(id_journal));
string insert_query = "INSERT INTO `info_journal`(`id_journal`, `nom_journal`, `date`, `id_fournisseur`, `id_atm`, `state`, `state_parse_journal`, `terminal`, `id_utilisateur`) VALUES ('"+s_id_journal+"','"+nom_journal+"',' ' ,' ' ,' ' ,' ' ,' ' ,' ' ,' ' )";
//int qstate = mysql_real_query(conn,insert_query.c_str(), strlen(insert_query.c_str()));
query_state=mysql_query(conn, insert_query.c_str());
if(!query_state)
{
cout << "Query Execution Problem " << mysql_errno(conn) << endl;
}
else
{
cout << endl << "success" << endl;
}
}
METHODE 2**
string Journal::find_nom_journal(const char* path)
{
string filename = string(path);
ifstream file1(filename);
string str_path = string(path);
//find filename
unsigned found = str_path.find_last_of("/\\");
string same_path = str_path.substr(found+1);
//cout << "this is the file name" << endl;
cout <<same_path << endl;
return same_path;
}