?
Solved

PHP multiple update query

Posted on 2007-10-02
7
Medium Priority
?
815 Views
Last Modified: 2008-09-08
Hello,

I am trying to update multiple rows with sql query.

while($data = mysql_fetch_array($_data)){
"update timedone set time=$time where pid = $data[pid]";
}

whenever i execute this query in PHP, it displays "page cannot be displayed";

How do I solve this issue???

Thank you.
0
Comment
Question by:terrani
  • 3
  • 2
5 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 20003953
what about this:

while($data = mysql_fetch_assoc($_data))
{
  mysql_execute("update `timedone` set `time`= '$time' where `pid` = {$data['pid']} ";
 }
0
 

Author Comment

by:terrani
ID: 20003972
angelIII // thank you.

um..but what is difference between mysql_query and mysql_execute ?

php.net shows "Note: mysqli_execute() is deprecated and will be removed. ";

can I use it???
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 20003985
actually, I posted the wrong function :.)


while($data = mysql_fetch_assoc($_data))
{
  mysql_query("update `timedone` set `time`= '$time' where `pid` = {$data['pid']} ";
 }

0
 

Author Comment

by:terrani
ID: 20008011
angelIII// thank you.

but..how does it help? I understand that mysql_fetch_assoc is faster than mysql_fetch_array, but does it make big difference???

0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22382266
looks like this got through the nets ..
>I understand that mysql_fetch_assoc is faster than mysql_fetch_array, but does it make big difference???
no. but being efficient in all the details is just good practise

>but..how does it help?
I used the correct mysql_query function, and in the query:
 `pid` = {$data['pid']} ";
is what will make the difference compared to:
  pid = $data[pid]";


0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question