Mod Adk Portal (2.1.1)

Adk portal is a portal integrated to SMF, with multiple extensions and features.
The portal is aimed at simple and intuitive to the Administrator.
It has all the characteristics of portal, in addition to having a great set of downloads, system of internal pages, etc.

Mod Adk Seo (3.0)

Adk Seo is an internal system of SMF to improve your ranking.
It has powerful features to appear on the top of major search engines.
With this product, you can change your urls, choose your format, encouraging social activity on your site, place their own sitemaps, etc.
Mod Adk Blog (3.0)

Adk blog is an internal system of SMF to help encourage business users.
This product will create a space where your users can use as your own blog, creating categories, entries, and managing your comments.


Usar Base de Datos en SMF (PHP)


Board:

Tutoriales

Topic:

Usar Base de Datos en SMF (PHP)


Description:

Foro de tutoriales para smf

Author Topic: Usar Base de Datos en SMF (PHP)  (Read 1070 times)

0 Members and 1 Guest are viewing this topic.

Usar Base de Datos en SMF (PHP)

Usar Base de Datos en SMF (PHP)
« on: September 26, 2010, 04:20:02 AM »
Bueno a pedido de mi amigo heracles, aca dejo armo un tutorial de como usar la Base de Datos en SMF 2.0.

Lo primero que voy a mostrar es a insertar/updatear campos en la tabla smf_settings.

Para esto existe una funcion muy importante de smf que es updateSettings()

Si quieren insertar nuevos campos en la tabla smf_settings, solo tienen que hacer de esta forma en su archivo php
Code: [Select]
<?php

updateSettings(
array(
'campo1' => 'valor1',
'campo2' => 'valor2',
'campon' => 'valorn',
)
);

?>


Asi cuantos valores quieran, pueden insertar en la tabla settings.... y si quieren updatear la tabla settings es de la siguiente forma:
Code: [Select]
<?php

updateSettings(
array(
'campo1' => 'valor1',
'campo2' => 'valor2',
'campon' => 'valorn',
),true
);

?>



Bueno ahora voy a mostrar como insertar un nuevo campo en diferentes tablas, aunque esto si ya han leido base de datos y conecciones les resultara facil y familiar.

Primero debemos establecer la global $smcFunc;
Code: [Select]
<?php
global $smcFunc;

Para insertar un nuevo dato en una tabla podemos hacer lo siguiente.
Code: [Select]
<?php
global 
$smcFunc;

$smcFunc['db_query']('','
INSERT INTO {db_prefix}tabla 
(campo1,campo2,campo3)
VALUES
(\''
.$valor1.'\',\''.$valor3.'\',\''.$valor2.'\')
'
);

?>


Para updatear cualquier tabla
Code: [Select]
<?php
global 
$smcFunc;

$smcFunc['db_query']('','
UPDATE {db_prefix}tabla
SET
campo1 = \''
.$valor1.'\',
campo2 = \''
.$valor3.'\',
campo3 = \''
.$valor3.'\'
'
);

?>


y con la funcion $smcFunc['db_query']() pueden hacer todo lo posible referido a consultas.

Esta es una forma simple y facil de trabajar con smf, solamente recuerden que es para smf, esto no sirve para trabajar independientemente, al menos que se asocie el SSI.php.

Pase a explicar de una forma muy simple, mas que nada dejo abierto esto a sus preguntas. Tambien me parecio importante explicar el updateSettings ya que es muy usado en smf

Si quieren preguntarme cualquier cosa de como crear, realizar algo, pueden hacerlo en este mismo post.!

lucas-ruroken

  • *
  • Posts: 8114



Sorry visitor. To access the SMF Personal answers, you need to Register or Login.

Atte. SMF Personal

Tags

 


 
Application Parser To Mod

It is a system developed by SMF Personal, similar to parse smf, but with the difference that it not only show us the steps to install mods but also show us the steps to uninstall and update mods.
The mods that can be analyzed are obviously those who are raised in SMF Personal.
Section Mods

In this section you will find all mods done by the staff and users of SMF Personal.
The mods are displayed in a simple and easy to read.
Section Tutorials

In this section you will find all the tutorials made by our staff and users of SMF Personal.
The tutorials are displayed in a simple and easy to read.

SMF 2.0.2 | SMF © 2011, Simple Machines | Adk Portal 2.1.1 © SMF personal  & Adk Seo 3.0
This site is not affiliated with or endorsed by Simple Machines