Sir,
how to write select query and insert query at the same time. I have one database that db having six field. waiting for your reply.
thanking you
5 7692
Sir,
how to write select query and insert query at the same time. I have one database that db having six field. waiting for your reply.
thanking you
Describe what you want to achieve and tell us the database you are using as well.
Do this in two different steps.. first execute the select query and then execute the insert query using the same mysql_query function. Also i believe if u want to edit the existing data(cause u demanded select and insert combo), then you need use UPDATE command, instead of insert
SAMPLE would be
[PHP]
$sql1="select * from mytable";
$con=mysql_query($sql1)
if($con){
$sql2="insert into mytable(column1,column2) values ('value1','value2')";
mysql_query($sql2);
}
else{
echo "Error executing first query";
exit
}[/PHP]
cheers !!
Do this in two different steps.. first execute the select query and then execute the insert query using the same mysql_query function. Also i believe if u want to edit the existing data(cause u demanded select and insert combo), then you need use UPDATE command, instead of insert
SAMPLE would be
[PHP]
$sql1="select * from mytable";
$con=mysql_query($sql1)
if($con){
$sql2="insert into mytable(column1,column2) values ('value1','value2')";
mysql_query($sql2);
}
else{
echo "Error executing first query";
exit
}[/PHP]
cheers !!
I wouldn't call that writing the select and insert queries at the same time but we'll have to see if that's what the OP wanted.
i have the same problem where i have two form,first form recieve data from serial port and insert these data into database,the second form select data from
the same database during the first form is inserting.whene i open second form
and select some data as a result hang.
need help urgent.
thanks
Alaa
the second form select data from
the same database during the first form is inserting.whene i open second form
You can't really do this.
You need to wait for the first query to finish executing because the new data may not be there yet.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Phil Powell |
last post by:
$sql = 'INSERT INTO fs_usermetadata (' . substr(trim($cols), 0,
strrpos(trim($cols), ',')) .
') VALUES (' . substr(trim($values), 0, strrpos(trim($values),
',')) . ')';
if (!mysql_query($sql))...
|
by: lea |
last post by:
I have two combobox, I let the user to select report criteria FROM xx TO
xx.
i have a button call btnPrint to select report criteria and print
according to the criteria.
I able to SELECT the...
|
by: jtocci |
last post by:
I'm having a big problem with CREATE RULE...ON INSERT...INSERT
INTO...SELECT...FROM...WHERE when I want to INSERT several (20~50)
records based on a single INSERT to a view. Either I get a 'too...
|
by: suslikovich |
last post by:
Hi all,
I am getting this error when insert values from one table to another in
the first table the values are varchar (10). In the second they are
datetime. The format of the data is mm/dd/yyyy...
|
by: DC |
last post by:
The problem
I'm using the .NET GridView and FormView objects for the first time and
im getting the error "An OleDbParameter with ParameterName '@ID' is not
contained by this...
|
by: Himmel |
last post by:
Hello!
The reference database I currently use runs queries that pull data from hundreds of tables in order to create user-friendly form view. The problem is that these queries can take upwards of...
|
by: =?Utf-8?B?Smlt?= |
last post by:
I have code that reads and parses a text file using a schema.ini file. Works
great. When I see the dataGrid it's exactly what I want.
Dim CString As String = _...
|
by: bozzzza |
last post by:
Lets say we select from TableA that joins to TableB
TableB also gets data inserted into into it via another query.
So I guess SQL server places a shared lock on Table A and Table B.
and the...
|
by: CK |
last post by:
How do I write a set based query? I have a groupSets table with fields
setId, idField, datasource, nameField, prefix, active
Data:
1,someIDfield, someTable, someField, pre1, 1
2,someotherIDfield,...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |