Varchar Mysql
#1

How can i set a string for varchar variable when i insert it through code?
I want when my player creates a house to set a string 'Unowned' and 'No Owner' to variables(varchared vars) HName and HOwner at the database how i can do that?
Reply
#2

in create table use VARCHAR(25) DEFAULT 'No Owner'
Reply
#3

Quote:
Originally Posted by Jefff
Посмотреть сообщение
in create table use VARCHAR(25) DEFAULT 'No Owner'
i dont create table through my programm i have already created a table is there a way to insert it later when the player created the house?
Reply
#4

Try
pawn Код:
ALTER TABLE table_name ALTER COLUMN HOwner VARCHAR(25) DEFAULT 'No Owner'
Reply
#5

Ok thanks and one last question if i make it manually through table do i have at default to use ' or just write inside the field the text?
Reply
#6

"Unknown" values should be represented by NULL. Processing of this information is to be done in code, not in the database.

Furthermore, Owner should be linked to the player's unique id in the player table. A player's name is only to appear once in the entire database. Any other tables that require the player's information must link to the original table via a foreign key.
Reply
#7

Umm i dropped the houses table and recreated manually and set default the texts i want and i just read vince's reply . Here is a picture of my structure of the table should i change something? Have i done something wrong?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)