Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 6th, 2006, 05:44 PM
Registered User
 
Join Date: Dec 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default C variable in WHERE clause problems

Hi all,
can someone show me the correct syntax if using a C variable in a where clause please

where valid='0' is fine but

char zro='0';
where valid=zro doesn't appear to work?

thanks
 
Old December 7th, 2006, 12:55 PM
Registered User
 
Join Date: Dec 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok solved it, thanks anyway:

sprintf(fnme, "'%s%s", usernm, "'"); // first put quote round it
sprintf(Query, "SELECT * FROM pwdatbla where usernm=%s", fnme);
if (mysql_query(conn, Query)) { //query the database

ian.t7(at)hotmail.co.uk





Similar Threads
Thread Thread Starter Forum Replies Last Post
Form Corruption / Problems with Where Clause jeremy1048 Access 7 October 22nd, 2007 09:52 AM
Problems using case statement in where clause vghiya SQL Server 2000 3 May 28th, 2007 05:12 AM
In a C prog want to use C variable in WHERE clause turnbui BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 December 6th, 2006 05:22 PM
Variable Problems WIx Beginning PHP 1 July 15th, 2004 10:45 AM
Facing Problems with text in a Where Clause mhosneddine Access 2 October 26th, 2003 04:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.