Jump to content

(SQL) Help with updating a table


mark1million

Recommended Posts

  • Moderators

HI,

I have been messing about for a few days not but cant seem to get the right code.

I want to update a the pireps table flighttype field where flightnum = T1%% that's not important but i cant get it to run.

Basically i have tours that i have now created a separate flighttype for, at the moment they are all in there as P for passenger flights, i want to update them to T for tours as im now reporting in the profiles flight types.

Any help would be appreciated.

Slightly going mad with banging my head against a wall :lol:

Link to comment
Share on other sites

Guest lorathon

and then if that works you can loop through

$sql = 'SELECT *
       FROM '.TABLE_PREFIX.'pireps
       where flightnum = \'T1%\'
       ';

$pireps = DB::get_results($sql);


foreach($pireps as $pirep) {

   $fields = array('flighttype' => 'T');

   PIREPData::updatePIREPfields($pirep->pirepid, $fields);
}

Link to comment
Share on other sites

Guest lorathon

Will this work? NOT TESTED. I would copy the pireps table to a backup and play with that one. Don't want to screw up the original.

UPDATE phpvms_pireps
SET `flighttype` = `T`
WHERE `flightnum` = `T1%`

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