•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 402,904 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,119 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 1054 | Replies: 1
![]() |
•
•
Join Date: Mar 2007
Location: Colombia
Posts: 19
Reputation:
Rep Power: 2
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
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,721
Reputation:
Rep Power: 36
Solved Threads: 884
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
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
std::string query = "SELECT * FROM table1 WHERE id = '"; query += value; query += "'";
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
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?



Linear Mode