News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Package Server DB

Started by brianjw, March 26, 2008, 06:44:22 PM

Previous topic - Next topic

brianjw

I am not familiar with the 2.0 database as of yet. I need to know what needs to be changed in the queries that remove and add a package server to the database from 1.1 to 2.0 Beta 3.
Here are the codes from 1.1:

   // Delete our package server if there is one.
   $request = db_query("
       DELETE FROM {$db_prefix}package_servers WHERE name = 'Gamerz Garage'", __FILE__, __LINE__);
     
   // Install our package server.
   $request = db_query("
      INSERT INTO {$db_prefix}package_servers (name,url)VALUES('Gamerz Garage','http://www.gamerzgarage.com/mods')", __FILE__, __LINE__);


Thanks,
brianjw

karlbenson


brianjw

Ok, well I can get some of it done. But I am just not very good with databases. Can someone help me finish this code?

   // Install our package server.
   $smcFunc['db_insert']('insert','
      '{db_prefix}package_servers',
     

H

Hi Brianjw,

Did you manage to do this?
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

brianjw

No, i am not good with db's... :(

SleePy

Are you trying to remove the entry from the package database?
Or are you attempting to do something else?
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

brianjw

I want to put this db query in the add_settings.php file to remove the package server named ___ if there is one and then to add a package server named ___. This way it will make it so there aren't duplicate servers. I am horrible with dbs.

SleePy

$request = $smcFunc['db_insert']('replace',
    '{db_prefix}package_servers',
    array(
        'name' => 'string',
        'url' => 'string',
    ),
    array(
        'Gamerz Garage', 'http://www.gamerzgarage.com/mods',
    ),
    array( 'id_server')
);


That should do it.
It will replace the entry if it exists otherwise it will insert it.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

brianjw

Thanks. I will try it out later. :)

Advertisement: