SQL commands in MOD

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
Cybeast Falzar
Registered User
Posts: 7
Joined: Thu Apr 05, 2007 6:16 pm

SQL commands in MOD

Post by Cybeast Falzar »

How would I add SQL commands, eg. inserting rows into tables

User avatar
Ash Hi Fi Zone
Registered User
Posts: 409
Joined: Fri Feb 09, 2007 11:55 am

Re: SQL commands in MOD

Post by Ash Hi Fi Zone »

First you need to store the SQL query in a string say $sql and then use $result = $db->sql_query($sql) to run the query..... Also you need to check the value returned by the above statement to check for any errors... If multiple rows are returned as the output of the SQL then you need to use $db->sql_fetchrow($result) to fetch the contents of each row.... Better take a look at some of the php files in the phpBB to know more deeply how it works.... ;)

Cybeast Falzar
Registered User
Posts: 7
Joined: Thu Apr 05, 2007 6:16 pm

Re: SQL commands in MOD

Post by Cybeast Falzar »

what I meant was how would I add something at the begining of the MOD that would add rows to the SQL when installing the MOD with EasyMOD

User avatar
Ash Hi Fi Zone
Registered User
Posts: 409
Joined: Fri Feb 09, 2007 11:55 am

Re: SQL commands in MOD

Post by Ash Hi Fi Zone »

#
#-----[ SQL ]------------------------------------------------
#

YOUR SQL STATEMENT HERE


As simple as that :P

See this article for the complete list of all the statements used in MODS.....

http://www.phpbb.com/community/viewtopic.php?t=61611

Post Reply

Return to “[2.0.x] MOD Writers Discussion”