1 Replies - 1228 Views - Last Post: 04 February 2014 - 09:34 AM

#1 Osafeliz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 16-January 14

Using variables instead of values at INSER TO (name,age)Value(var,var2

Posted 04 February 2014 - 09:32 AM

I am creating a c++ program using SQL statements to write string variables (powname,frecchan,pownumber) into a Mysql data base this is my code:
[
if (mysql_query(con, "INSERT INTO log(ip, outlet, action)" << "VALUES (\"\",\"" << powname << "\",\"" << frecchan << "\",\"" << pownumber << "\" )"))
{
finish_with_error(con);
}
]
I get the following errors when compiling with gcc:
mysqlled.cpp:222: error: invalid operands of types ‘const char [36]’ and ‘const char [13]’ to binary ‘operator<<’
I know the mysql_query and INSERT INTO works because when I use values instead of varibles it works find and ofcourse I do not have to use the scape sequences.
Can anyone help me out I do not know what else to do.
Thank you so much

Is This A Good Question/Topic? 0
  • +

Replies To: Using variables instead of values at INSER TO (name,age)Value(var,var2

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9195
  • View blog
  • Posts: 34,523
  • Joined: 12-June 08

Re: Using variables instead of values at INSER TO (name,age)Value(var,var2

Posted 04 February 2014 - 09:34 AM

Please do not create duplicate topics. Closing.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1