#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    19
    Rep Power
    0
    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
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    43
    Rep Power
    15
    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

Similar Threads

  1. ipfilter ruleset review please
    By tlthomas in forum BSD Help
    Replies: 11
    Last Post: March 20th, 2004, 05:51 PM
  2. Dynamic DNS to local web server
    By uniopp in forum DNS
    Replies: 9
    Last Post: February 1st, 2004, 06:26 AM
  3. creating sql pass thru for access using VBA - help!!
    By Glenstr in forum Database Management
    Replies: 0
    Last Post: May 8th, 2003, 06:12 PM
  4. ipf filter ruleset for masquerading/NAT
    By munkfish in forum BSD Help
    Replies: 16
    Last Post: January 28th, 2002, 04:42 PM
  5. Replies: 0
    Last Post: May 31st, 2000, 02:28 AM

IMN logo majestic logo threadwatch logo seochat tools logo