Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6586079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:44:40+00:00 2026-05-25T16:44:40+00:00

please verify my below code, my drupal is D6, Not creating table as well

  • 0

please verify my below code, my drupal is D6,
Not creating table as well not deleting tables.

<?php
// custom1.install

function custom1_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE IF NOT EXISTS block_quiz_customer_ans (
        crid int(30) NOT NULL AUTO_INCREMENT,
        qid int(30) NOT NULL,
        cust_ans varchar(255) NOT NULL,
        cust_ip varchar(255) NOT NULL,
        cust_res_date_time varchar(255) NOT NULL,
        created varchar(50) NOT NULL,
        status tinyint(20) NOT NULL DEFAULT '1',
        PRIMARY KEY (`crid`)
        ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=0;");
      break;
  }
}

function custom1_uninstall() {
  print "This is uninstall";
  drupal_uninstall_schema('block_quiz_customer_ans');
  variable_del('block_quiz_customer_ans');
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:44:41+00:00Added an answer on May 25, 2026 at 4:44 pm

    Use schema instead of mysql queries for the install file of a module.

    function custom1_install(){
    $schema['table_name'] = array(
        'description' => '<description',
        'fields' => array(
          'field_name' => array(
            'description' => '<description>',
            'type' => '<datatype>',
          ),
        ),
        'primary key' => array('<field_name>'),
      );
    return $schema;
    
    }
    

    Hope this helps!!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hello Friends please verify my code Is it a right way to pass optional
Below is the code i use to extract data from a table to a
2011-12-08 17:24:04 - PHP Warning: Unknown: Failed to write session data (files). Please verify
The FluentAPI can not create a relational model based on the code below: public
I've created a function in JavaScript to verify an html form data, my code
Please read the whole question. I'm not looking for an approach to managing multi-lingual
Please, provide code examples in a language of your choice. Update : No constraints
please verify me if I am right: when a program encounters a exception we
C++ newbie question. Please, verify I'm doing it right. I have a global application
Can some CSS ninja please verify if my thought process is right or wrong.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.