
- You are not logged in. | Login
January 18, 2007 10:39 am
- Conker
- Member


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


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


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


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


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"); // executesI 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


Re: Creating of two tables in one query. Everything seems to be ok, but...
Hey, men! That topic has been already in the forum! 
PHP monster


