Insert Data Into a Database

Hello

How can i send data into a database table ?

I created field in phpvms_pilots table and name it current , i want send last location in phpvms_pilots table .

<?php
$allpilots = PilotData::getAllPilots();
foreach($allpilots as $pilot)

{
?>
<?php
include 'db2.php';
$last_location = PIREPData::getLastReports($pilot->pilotid, 1, PIREP_ACCEPTED);

mysql_query("UPDATE phpvms_pilots SET current=('$last_location->arricao') WHERE ID='$pilot->pilotid'")
?> 
<?php

}

?>

but no data insert in current field .

Solved

<?php
$allpilots = PilotData::getAllPilots();
foreach($allpilots as $pilot)

{
?>
<?php
include 'db2.php';
$last_location = PIREPData::getLastReports($pilot->pilotid, 1, PIREP_ACCEPTED);
mysql_query("UPDATE phpvms_pilots SET current = ('$last_location->arricao') WHERE pilotid ='$pilot->pilotid'");
?> 
<?php

}
?>

I want automatically update current field every 10 minutes

You can use the API too:

PilotData::updateProfile($pilotid, array('current' => 'value'));
1 Like

Thanks Nabeel