|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
i want to add a record in a table but
through a varible mysql_query( &mysql, "INSERT INTO tablename(acctnbr, amount) VALUES (12345, 651.30)" ); i want to pass the value of acctnbr and amount through veriables how can i do it ? thanks.... |
|
#2
|
|||
|
|||
|
In PHP:
$result=mysql_query("insert into tablename (acctnbr,amount) values ($acctnbr,$amount)"); |
|
#3
|
|||
|
|||
|
i want to know about c coding not for php
to pass a veriable in mysql_query function. thanks... |
|
#4
|
|||
|
|||
|
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by abbas:
i want to know about c coding not for php to pass a veriable in mysql_query function. thanks...[/quote] this should work 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); |
|
#5
|
|||
|
|||
|
error:
String not allow to compile if i use char accout[30] and use your formate then not happen any thing after run the program. thanks please review your query is it right? |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > how can i pass a variable in mysql_query? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|