Link to home
Start Free TrialLog in
Avatar of terrani
terrani

asked on

PHP multiple update query

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.
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

what about this:

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

ASKER

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???
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of terrani

ASKER

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???

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]";