473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

insert in to $variable valuse

$variable= 123;

$query = "INSERT INTO $variable VALUES ('$TYPE','$TASK');

will this work?? please tell..
i have to use a value stored ina variable in place of the table name.
Nov 8 '06 #1
5 4815
$variable= 123;

$query = "INSERT INTO $variable VALUES ('$TYPE','$TASK');

will this work?? please tell..
i have to use a value stored ina variable in place of the table name.
123 is your table name?
Don't forget to close your quotes at the end of the query.
Nov 8 '06 #2
vssp
268 100+
Chck the variable value pass teh insert query


vssp
Nov 10 '06 #3
Nert
64
$variable= 123;

$query = "INSERT INTO $variable VALUES ('$TYPE','$TASK');

will this work?? please tell..
i have to use a value stored ina variable in place of the table name.
hi,

i don't think that will work, you did not specified any table name where that value be inserted..

try to follow this simple query for inserting values on a database table
"INSERT INTO tablename fields VALUES('values')";
and don't forget to close the tags..

bye -- bye

--nert
Nov 11 '06 #4
ronverdonk
4,258 Expert 4TB
Excuse me! There is some misconecption about using PHP in constructing sql statements here.

Of course it will work, building a statement like this is perfectly legal:

[php]
$My_table = "Clients";
$column = "clientname";\
$value = "Johnson";
$sql_stmt = "SELECT * FROM $My_table WHERE $column = '$value'";
[/php]
Ronald :cool:
Nov 11 '06 #5
Nert
64
Excuse me! There is some misconecption about using PHP in constructing sql statements here.

Of course it will work, building a statement like this is perfectly legal:

[php]
$My_table = "Clients";
$column = "clientname";\
$value = "Johnson";
$sql_stmt = "SELECT * FROM $My_table WHERE $column = '$value'";
[/php]
Ronald :cool:
upss! I'm sorry (^_^) i did not read student1's post very well cause i'm in a hurry last time, i thought the variable $variable having the value '123' is the value to be inserted in a table.., that's why i said it won't work because student1's did not specify any table. yah of course that will work with php.
Nov 14 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: jason | last post by:
How does one loop through the contents of a form complicated by dynamic construction of checkboxes which are assigned a 'model' and 'listingID' to the NAME field on the fly in this syntax:...
1
by: seahorse123 | last post by:
I want to insert records to the table1 from variable and table2, for example: "insert into table1 (column1,column2,column3) from ('abcd',select a,b from table2)" where insert variable 'abcd'...
1
by: Dark | last post by:
Im trying to insert a clob into the database and I get the following error. DBD::DB2::st execute failed: SQL0804N The application program input parameters for the current request are not...
3
by: Andrew Clark | last post by:
*** post for FREE via your newsreader at post.newsfeed.com *** it's been a while since i have poseted to this newsgroup, but for a long time i was not programming at all. but now that i am out of...
7
by: David Bear | last post by:
I have a dictionary that contains a row of data intended for a data base. The dictionary keys are the field names. The values are the values to be inserted. I am looking for a good pythonic...
7
by: annerhexian | last post by:
hi to all i am confused right now.. im just new in php.. and i have syntax error in my codes.. pls take a look? database name: ranking table: form1 fields: form1academicbachelor ...
2
by: yeap | last post by:
Hi All, I can't insert java variable into ms access database. I'm using odbc connection to ms access. Below are my coding. try { ...
2
by: btuisee | last post by:
I'm having an issue getting a variable to pass through to an oracle database. I have an insert statment and one of the values are a variable called q1. Q1 is a variable that gets it's value from a...
1
by: waqasahmd | last post by:
Hi i have two tables 1- Person 2- Account In Account table i have key accountID which is a FK in Person table. when i run the insert query as
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.