| | |
MySQL++ query question
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2007
Posts: 35
Reputation:
Solved Threads: 1
I want to make a query in C++ using the MySQL++ API.
Here is my problem, in PHP for example I make something like this:
$query = "SELECT * FROM table1 WHERE id = " . $value;
In C++ I can't do that. I need a way to make $value be part of the query string. I know it is a silly question, but can someone help me find this answer?
Thank You
Here is my problem, in PHP for example I make something like this:
$query = "SELECT * FROM table1 WHERE id = " . $value;
In C++ I can't do that. I need a way to make $value be part of the query string. I know it is a silly question, but can someone help me find this answer?
Thank You
you could use std::string class and just concantinate the value with the string
now the problem is that if value is a string you will probably have to enclose it in quotes
C++ Syntax (Toggle Plain Text)
std::string query = "SELECT * FROM table1 WHERE id = "; query += value;
now the problem is that if value is a string you will probably have to enclose it in quotes
C++ Syntax (Toggle Plain Text)
std::string query = "SELECT * FROM table1 WHERE id = '"; query += value; query += "'";
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Similar Threads
- test mysql query for no results (PHP)
- Double MySQL Query (PHP)
- Python Tuples and Mysql Query (MySQL)
- MySQL query's (MySQL)
- Change MySQL Query Timeout Period (MySQL)
- probelm with autogenerated mysql query (PHP)
- problem with autogenerated mysql query (MySQL)
Other Threads in the C++ Forum
- Previous Thread: Dev C++ --> URGENT PLZ
- Next Thread: User-Defined Function - setup right?
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion count database delete deploy desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph homeworkhelp homeworkhelper iamthwee ifstream input int integer lib linkedlist linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






