vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How do i creat a table in mysql? (https://vborg.vbsupport.ru/showthread.php?t=218997)

dxlwebs 07-20-2009 08:26 AM

How do i creat a table in mysql?
 
hey all first i would like to say sorry for this dumb question but im creating a feature for my mod and my wife is due to give birth tomorrow and for some reason my mind is just blank when it comes to mysql today but i have to finish this today before the baby is born!

basically what i want to do is creat a new table! here's what i have written!(or can remember)

Code:

<installcode><![CDATA[
                $db->hide_errors();
                $vbulletin->db->query_write("
                CREATE TABLE IF NOT EXISTS `". TABLE_PREFIX ."table1 `(
  `test` smallint(6) unsigned NOT NULL auto_increment,
  `test2` varchar(250) collate latin1_general_ci NOT NULL,
  `test3` varchar(250) collate latin1_general_ci NOT NULL,
  `test4` tinyint(1) NOT NULL default '0',
  `test5` tinyint(1) unsigned NOT NULL,
  `test6` int(10) unsigned NOT NULL,
  `test7` smallint(6) unsigned NOT NULL,
  PRIMARY KEY  (`test`),
  KEY `threadid` (`threadid`)
) ENGINE=MyISAM ");]]></installcode>
                        <uninstallcode><![CDATA[$vbulletin->db->query_write("DROP table " . TABLE_PREFIX . "table1");]]></uninstallcode>

if some one could please remind me what to do that would be great i really can't believe how i have forgotten what to do! but basically what i have written doesnt seem to write any tables at all!

thanks for your help

Marco van Herwaarden 07-20-2009 10:43 AM

Remove the hide_errors, so you can see what goes wrong. But my guess is that you will receive a message that the column 'threadid' is not known.

dxlwebs 07-20-2009 03:46 PM

hmm possibly if someone could post how it is suppost to be done that would be creat

Lynne 07-20-2009 04:00 PM

Just download a mod that adds a table and you will see how it's done. I would guess a mod like the arcade would add a table.

Marco van Herwaarden 07-21-2009 12:05 PM

How what is supposed to be done?

You have at least 1 error in the query as you are defining a KEY for a column that doesn't exist.


All times are GMT. The time now is 06:22 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01163 seconds
  • Memory Usage 1,716KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete