News:

Wondering if this will always be free?  See why free is better.

Main Menu

smf_db_create_table $indexes problem

Started by Yağız..., March 15, 2009, 10:42:12 AM

Previous topic - Next topic

Yağız...

When I leave blank $indexes it doesn't want to create the table.
Here is my code:
$smcFunc['db_create_table']('buddies', $columns, array(), array(), 'ignore');

I don't want any PRIMARY or UNIQUE key in the table...

onepiece

Any errors you are getting? I'm guessing that you have some incorrect definitions for your columns. An auto_increment, or a default value for text field and such. We may have a better idea if you could show your $columns array too.

Yağız...

This is my code for buddies table:
$columns = array(
array(
'name' => 'ID_MEMBER',
'type' => 'mediumint',
'size' => '8',
'auto' => true,
'default' => 0,
),
array(
'name' => 'BUDDY_ID',
'type' => 'mediumint',
'size' => '8',
'default' => 0,
),
array(
'name' => 'approved',
'type' => 'smallint',
'size' => '1',
'default' => 0,
),
array(
'name' => 'position',
'type' => 'tinyint',
'size' => '4',
'default' => 0,
),
array(
'name' => 'time_updated',
'type' => 'int',
'size' => '11',
'default' => 0,
),
array(
'name' => 'requested',
'type' => 'mediumint',
'size' => '8',
'default' => 0,
),
);
$smcFunc['db_create_table']('buddies', $columns, array(), array(), 'ignore');

There is no error when I upload the package. It creates all the tables, but not this one. And, in this table, there shouldn't be any auto_increment etc...

onepiece

But there is one, 'ID_MEMBER' field.

Code (Find and Remove) Select
      'auto' => true,

Also, I suggest that you use lowercase for field names for compatibility with all database systems supported by SMF.

Yağız...

#4
Quote from: Tenma on March 16, 2009, 07:38:14 AM
But there is one, 'ID_MEMBER' field.

Code (Find and Remove) Select
      'auto' => true,

Also, I suggest that you use lowercase for field names for compatibility with all database systems supported by SMF.
Thanks, I forgot it :)

This codes are for Ultimate Profile's 2.0 RC1 version. So, it's all in uppercase in 1.1.8 version. That's why I didn't use lowercase.

Edit:
Worked ;) Thanks Tenma.

Advertisement: