User Name Password Register
DaniWeb IT Discussion Community
All
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
Reply
Join Date: Mar 2007
Location: Colombia
Posts: 19
Reputation: Tales is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
Tales Tales is offline Offline
Newbie Poster

MySQL++ query question

  #1  
Apr 3rd, 2007
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,721
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 36
Solved Threads: 884
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: MySQL++ query question

  #2  
Apr 3rd, 2007
you could use std::string class and just concantinate the value with the string
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
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 3:25 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC