Uutiset:

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

Main Menu
Advertisement:

Need help with smcFunc['db_create_table']

Aloittaja jjsmith, lokakuu 16, 2013, 01:56:18 AP

« edellinen - seuraava »

jjsmith

Hi,

I'm running a command-line script in which I want to use smcFunc['db_create_table'](...) to create a table.

However, i get the error "Notice: Undefined index: db_create_table in ...."

I did a var_dump($smcFunc) and sure enough, none of the "Database Package Functions" (listed here -http://wiki.simplemachines.org/smf/$smcFunc) are in the $smcFunc variable.  Only the db_query, db_fetch_row, etc are there.

I include the following files in my php script:
require('../SSI.php');
include('../Sources/DbPackages-mysql.php');

DbPackages-mysql.php is where db_create_table is defined, but that doesn't update $smcFunc.

Is there something else I need to include or something I need to execute?  It might even be a php thing vs smf thing...

Thanks,
Josh





andershz


jjsmith

That's the ticket!

Thanks andershz!  Made my day.  Progress is definitely now at hand.

For my edification - do you know of any official smf documentation about that?

Josh

andershz

There is, but not easy to find:
http://dev.simplemachines.org/smcfunctions.php

I also think the text is misleading:

Database Package functions were also introduced in SMF 2.0. These special functions allow customization creators to easily modify a database that will support multiple database types. The below functions only exist when using db_extend('packages');. By Default this is automatically called in the Package Manager.

I interpret that as the extra functions should always be available when installing a mod, but apparently "in the Package Manager" means something else.

emanuele

#4
As far as I remember it is, but the OP is using SSI (at least from the code he posted).

About documentation, you can take a look at:
http://wiki.simplemachines.org/smf/$smcFunc

ETA: fixed link.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

andershz

You remember correctly, I forgot about the SSI bit.

The $smcFunc wiki link is good, but it doesn't mention that db_extend is needed for the Database Package Functions, (when using SSI).

emanuele

There is an "edit" button over there, you can add it. :P ;)


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

andershz


emanuele



Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Advertisement: