php - Insert into MySQL a variable that changes for each row -


    while ($row = mysql_fetch_array($sqlquery))          {      $fd = strtotime($row['date1']);     $sd = strtotime($row['date2']);       $dates = floor(($sd - $fd ) / 86400);      $price = $dates * 25;    } 

i want insert table $price each row. cannot single insert because $price different each time.

"insert `yourtable` ('price') values ('".$price."')"; 

put in while loop,

while ($row = mysql_fetch_array($sqlquery))          {      $fd = strtotime($row['date1']);     $sd = strtotime($row['date2']);       $dates = floor(($sd - $fd ) / 86400);      $price = $dates * 25; "insert `yourtable` ('price') values ('".$price."')";    } 

this means there insert every iteration of while loop, $price being different each time.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -