Jump to content

Insert Data Into a Database


faraz

Recommended Posts

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 .

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...