473,402 Members | 2,046 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,402 software developers and data experts.

simultaneous updating of rows in a databse

How do I simultaneously update rows of data in a database?
Should I Update it one by one? Or is there any other way to do it?

Expand|Select|Wrap|Line Numbers
  1. $query = mysql_query("UPDATE tblProducts SET prod_code='$prod_code1'");
  2. if($query)
  3. {
  4. $query2 = mysql_query("UPDATE tblProducts SET prod_code='$prod_code2'");
  5.  
  6. if($query2)
  7. {
  8.     echo "update success!";
  9. }
  10. }
  11.  
Oct 11 '07 #1
3 1298
t0m66
6
Well, that code there will just set it to the last value because there is no WHERE condition. (First, it will set it to query 1's value, but then it will all be set to query 2's value). To run multiple queries in a MySQL call, you can seperate them with semicolons, but I wouldn't know why you'd want to do that.
Oct 11 '07 #2
gregerly
192 Expert 100+
To run multiple queries in a MySQL call, you can seperate them with semicolons
I'm actually pretty sure mysql_query() can only run one query at a time. Seperating with semicolons won't work.

From the www.php.net website:

mysql_query() sends an unique query (multiple queries are not supported) to the currently active database on the server that's associated with the specified link_identifier.

Here is the link: php.net - info on mysql_query()
Oct 12 '07 #3
can't i do something like that of how inserting data is done?

Expand|Select|Wrap|Line Numbers
  1. $query = mysql_query("INSERT INTO tblProducts (product_id, description)VALUES ('prod_id1','desc1'),('prod_id2','desc2')");
Oct 15 '07 #4

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

Similar topics

5
by: Fred | last post by:
Hi out there, I have problems finding a way to warn a user that another user intends soon to update the same specific row. Let me explain. User 1 get to a JSP "update customer record" page....
0
by: SimonC | last post by:
I'm looking to do something similar to a feature found on Ticketmaster.com, where you select your seats at a venue, and then you have two minutes in which to take or leave them. QUESTION 1a....
1
by: Srinadh | last post by:
Hi all, We have files with about 20 to 30 fields per row. We are trying to update such files with about 60 rows as contiguous data in a CLOB field. It passes through. But when we try...
1
by: Luis Esteban Valencia | last post by:
Hello Everyone, Iam an intermediate ASP.Net programmer and iam facing a challenging task. I have a table in MS-SQL server database called 'Members'. The table has following fields... ...
0
by: Nir Amber via DotNetMonster.com | last post by:
I cant seem to get the databse to update the tables. i get the following error "System.InvalidOperationException: Missing the DataColumn 'description' in the DataTable 'Transactions' for the...
4
by: Geoff | last post by:
Hi I'm hoping somebody can help me with the following problem that has occurred to me. Suppose I have two tables in an SQL Server database. Let's call these tables A and B. Assume that A has...
9
by: Dejan | last post by:
Hy, Sorry for my terreble english I have this simple code for deleting rows in mysql table... Everything works fine with it. So, what do i wanna do...: my sql table looks something like...
6
by: saeedeh | last post by:
hi to all i have some problem with fetching my form enteries. the problem is when i post some enteries through a form to a databse called 'applicant' and try to fetch and print it nothing appears.it...
8
by: backups2007 | last post by:
is it possible to insert, say for example, 5 rows of records in a table? is this possible? $query1 = mysql_query("INSERT INTO tbl_items (item_code, description) VALUES ('$item_code',...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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.