★ wanayoo — archive 1999 http://www.devshed.com/Talk/Forums/Forum4/HTML/000508.htmlNouvelle recherche | Portail wanayoo
DevShed Menu
* DevShed Home
* Developer News
* DevShed Brain Dump




UBBFriend: Email This Page to Someone!
  DevShed Discussion Forums
  MySQL
  how can i pass veriable in mysql_query

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   how can i pass veriable in mysql_query
abbas
Member
posted May 29, 2000 04:37 AM     Click Here to See the Profile for abbas   Click Here to Email abbas     Edit/Delete Message Reply w/Quote
i want to pass a verible in mysql_query
i tested following code but compile error came for that
String query,acctnbr,amount;

accntnbr = [(whatever the variable is)];
amount = [(whatever the variable is)];

query = "insert into tablename (acctnbr,amount) values (%s,%s)",acctnbr,amount);
mysql_query(&mysql,query);


what is the right and easiest way for that?
thanks

esconsult
Member
posted May 29, 2000 08:01 PM     Click Here to See the Profile for esconsult   Click Here to Email esconsult     Edit/Delete Message Reply w/Quote
Do like so...

$var1 = "4352";
$var2 = 45.00;

$query = "insert into table (acctnbr,amount) values ('$var1', '$var2')";
mysql_query($mysql,$query);

------------------
PHP, Perl, SQL Programming at http://www.mentalobjects.com

All times are MST (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | DevShed.com

Copyright © 1997-2000 ngenuity. All rights reserved.

Powered by: Ultimate Bulletin Board, Version 5.41a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 1999.