• You are not logged in. | Login

Post a reply

  • Index
  •  » Help me!
  •  » Creating of two tables in one query. Everything seems to be ok, but...

January 18, 2007 10:39 am

Conker
Member
Ranks

Creating of two tables in one query. Everything seems to be ok, but...

Here is the query:

CREATE TABLE `uri8y_ban_list` 
(  
    `ban_id` mediumint(8) UNSIGNED NOT NULL auto_increment, 
    `ban_type` VARCHAR(15) NOT NULL DEFAULT '', 
    `ban_value` VARCHAR(15) NOT NULL DEFAULT '', 
    `ban_reason` TEXT NOT NULL, 
    PRIMARY KEY (`ban_id`) 
); 

CREATE TABLE `uri8y_blocks` 
( 
    `block_id` mediumint(8) UNSIGNED NOT NULL auto_increment, 
    `block_position` VARCHAR(50) NOT NULL DEFAULT '', 
    `block_title` VARCHAR(100) NOT NULL DEFAULT '', 
    `block_show_title` BOOL, 
    `block_type` VARCHAR(4) NOT NULL DEFAULT '', 
    `block_content` LONGTEXT NOT NULL, 
    `block_access` TINYINT(4) NOT NULL, 
    `block_groups` LONGTEXT NOT NULL, 
    `block_enabled` BOOL, 
    `block_expire` BOOL, 
    `block_expire_date` INT(11) NOT NULL, 
    `block_expire_action` BOOL, 
    PRIMARY KEY (`block_id`) 
);

MySQL doesn't accept. There is an error:

MySQL returned: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '; CREATE TABLE `uri8y_blocks` ( `block_id` medium

When I create tables seperately everything is ok, together they don't work.

What I do wrong?


 

 

January 18, 2007 11:50 am

R@mzess
Member
Ranks

Re: Creating of two tables in one query. Everything seems to be ok, but...

And where is one query?
I see two


 

 

January 18, 2007 11:54 am

Conker
Member
Ranks

Re: Creating of two tables in one query. Everything seems to be ok, but...

Sorry, I said wrong, but the matter is the same. Ok, I have two queries, but if I execute them together MySQL doesn't like it. OK?


 

 

January 18, 2007 11:56 am

R@mzess
Member
Ranks

Re: Creating of two tables in one query. Everything seems to be ok, but...

No, it's not. You give just some pieces of information, actually I'm nnot goin to write the question insted of you


 

 

January 18, 2007 12:01 pm

Conker
Member
Ranks

Re: Creating of two tables in one query. Everything seems to be ok, but...

Ok, enough. Here is what SQL class returned me:

// SQL class 
class sql 
{ 
... 
// here is the query function: 

function query($query = '') 
{ 
  if($result = @mysql_query($query) return $result; 
  else  
  { 
    echo "Query fail. MySQL return: ".mysql_error(); 
   // ... 
   //logging
   // ... 
   return false; 
  } 
} 
... 
} 
// here what I try to do: 
$sql->query("both queries"); 
CREATE TABLE `uri8y_blocks` ( `block_id` medium, 
echo "<hr>"; 
$sql->query("first query"); // executes 
echo "<hr>"; 
$sql->query("second query"); // executes

I cant use both queries together:

CREATE TABLE `{prefix}ban_list` 
(  
    `ban_id` mediumint(8) UNSIGNED NOT NULL auto_increment, 
    `ban_type` VARCHAR(15) NOT NULL DEFAULT '', 
    `ban_value` VARCHAR(15) NOT NULL DEFAULT '', 
    `ban_reason` TEXT NOT NULL, 
    PRIMARY KEY (`ban_id`) 
); 

CREATE TABLE `{prefix}blocks` 
( 
    `block_id` mediumint(8) UNSIGNED NOT NULL auto_increment, 
    `block_position` VARCHAR(50) NOT NULL DEFAULT '', 
    `block_title` VARCHAR(100) NOT NULL DEFAULT '', 
    `block_show_title` BOOL, 
    `block_type` VARCHAR(4) NOT NULL DEFAULT '', 
    `block_content` LONGTEXT NOT NULL, 
    `block_access` TINYINT(4) NOT NULL, 
    `block_groups` LONGTEXT NOT NULL, 
    `block_enabled` BOOL, 
    `block_expire` BOOL, 
    `block_expire_date` INT(11) NOT NULL, 
    `block_expire_action` BOOL, 
    PRIMARY KEY (`block_id`) 
);

 

 

January 18, 2007 12:03 pm

phppat
Member
Ranks

Re: Creating of two tables in one query. Everything seems to be ok, but...

Hey, men! That topic has been already in the forum! mad


PHP monster

 

 
  • Index
  •  » Help me!
  •  » Creating of two tables in one query. Everything seems to be ok, but...
  • Actions
  • Top
ITCrimea. Ukraine Web Development Company. Professional Developers and Web Designers Team
Custom Web Designs, Internet Applications, E-Commerce Websites, Interactive Sites, Database-Driven Sites and Services