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.
terraniAsked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
actually, I posted the wrong function :.)


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

0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
what about this:

while($data = mysql_fetch_assoc($_data))
{
  mysql_execute("update `timedone` set `time`= '$time' where `pid` = {$data['pid']} ";
 }
0
 
terraniAuthor Commented:
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
 
terraniAuthor Commented:
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
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.