SQLITE help
#1

PHP Code:
new str[500] = "CREATE TABLE IF NOT EXISTS `USERS` ";
    
strcat(str"(`Name`, ,`Password`,, `Admin`,, `Vip`,, `Age`,");*/
    
strcat(str"`Money`, `Level`, `Gender`, `Accent`, `Skin`,");
    
strcat(str"`CarLic`, `BoatLic`, `FlyLic`, `PosX`, `PosY`,");
    
strcat(str"`PosZ`, `PosAngle`, `Payday`, `HadPayDay`, `Family`,");
     
strcat(str"`Faction`, `Tutorial`, `FactionRank`, `Injured`, `Health`,");
     
strcat(str"`Armour`, `VWorld`, `Interior`, `Job`, `BankBalance`,");
     
strcat(str"`Weapon1`, `Weapon1Ammo`, `Weapon2`, `Weapon2Ammo`, `Weapon3`,");
     
strcat(str"`Weapon3Ammo`, `Weapon4`, `Weapon4Ammo`, `Weapon5`, `Weapon5Ammo`,");
     
strcat(str"`Weapon6`, `Weapon6Ammo`, `Weapon7`, `Weapon7Ammo`, `Weapon8`,");
     
strcat(str"`Weapon8Ammo`, `Weapon9`, `Weapon9Ammo`, `Weapon10`, `Weapon10Ammo`,");
     
strcat(str"`Weapon11`, `Weapon11Ammo`, `Weapon12`, `Weapon12Ammo`, `Weapon13`,");
     
strcat(str"`Weapon13Ammo`, `PRadio`, `PRadioFreq`, `CigarSticks`, `WineBottles`)");
        
db_query(PGRPstr); 
is there something wrong here "i get the error this database is not a sqlite version 3 database"
Reply
#2

There is no need for this, use a tool to create your DB tables manually why bother writing this when your going to create a table once?
Reply
#3

Quote:
Originally Posted by [uL]Pottus
View Post
There is no need for this, use a tool to create your DB tables manually why bother writing this when your going to create a table once?
Much better to have it in the code IMO, that way when you start your server the database is automatically created. I'd have my code do the work for me, rather than download and use a tool.

Also if you use a tool and want to release your script you will need to distribute the db file with it too (or ask end user to use a tool).

EDIT: @OP there seems to be a lot wrong with the statement there, just on first glance you have double comma's in your statement (,,). You also don't need to use 'strcat' that many times - most of that would go in one line.
Reply
#4

i fixed the double comas it was a error :P but that is ok?
Reply
#5

Sorry for double post but i don't know why i cant see the edit quote etc etc tabs......

PHP Code:
strcat(str"(`Name` VARCHAR,`Password` VARCHAR, `Admin` INTEGER, `Vip` INTEGER, `Age` INTEGER, `Money` INTEGER, `Level` INTEGER, `Gender` INTEGER, `Accent` INTEGER, `Skin` INTEGER, `CarLic` INTEGER, `BoatLic` INTEGER, `FlyLic` INTEGER, `PosX` FLOAT, `PosY` FLOAT,");
    
strcat(str"`PosZ` FLOAT, `PosAngle` FLOAT, `Payday` INTEGER, `HadPayDay` INTEGER, `Family` INTEGER, `Faction` INTEGER, `Tutorial` INTEGER, `FactionRank` INTEGER, `Injured` INTEGER, `Health` FLOAT, `Armour` FLOAT, `VWorld` INTEGER, `Interior` INTEGER, `Job` INTEGER, `BankBalance` INTEGER, `Weapon1` INTEGER,");
    
strcat(str"`Weapon1Ammo` INTEGER, `Weapon2` INTEGER, Weapon2Ammo` INTEGER, `Weapon3` INTEGER, `Weapon3Ammo` INTEGER, `Weapon4` INTEGER, `Weapon4Ammo` INTEGER, `Weapon5` INTEGER, `Weapon5Ammo` INTEGER, `Weapon6` INTEGER, `Weapon6Ammo` INTEGER, `Weapon7` INTEGER, `Weapon7Ammo` INTEGER, `Weapon8` INTEGER, `Weapon8Ammo` INTEGER, `Weapon9` INTEGER,");
    
strcat(str"`Weapon9Ammo` INTEGER, `Weapon10` INTEGER, `Weapon10Ammo` INTEGER, `Weapon11` INTEGER, `Weapon11Ammo` INTEGER, `Weapon12` INTEGER, `Weapon12Ammo` INTEGER, `Weapon13` INTEGER, `Weapon13Ammo` INTEGER, `PRadio` INTEGER, `PRadioFreq` INTEGER, `CigarSticks` INTEGER, `WineBottles` INTEGER)"); 
i revised my code i think this is right but there is something that makes the database error
Reply
#6

Here's the problem:
Code:
... `Weapon2` INTEGER, Weapon2Ammo` INTEGER ...
Reply
#7

you cant use numbers?
Reply
#8

No, it lacks a `.
Reply
#9

how come if i use more than 3 strcats the database error and thx Finn
Reply
#10

sorry for double post

PHP Code:
 strcat(str"(`Name` VARCHAR,`Password` VARCHAR, `Admin` INTEGER, `Vip` INTEGER, `Age` INTEGER, `Money` INTEGER, `Level` INTEGER, `Gender` INTEGER, `Accent` INTEGER, `Skin` INTEGER, `CarLic` INTEGER, `BoatLic` INTEGER, `FlyLic` INTEGER, `PosX` FLOAT, `PosY` FLOAT, `PosZ` FLOAT, `PosAngle` FLOAT, `Payday` INTEGER, `HadPayDay` INTEGER, `Family` INTEGER, `Faction` INTEGER, `Tutorial` INTEGER, `FactionRank` INTEGER, `Injured` INTEGER, `Health` FLOAT, `Armour` FLOAT, `VWorld` INTEGER,");
    
strcat(str"`Interior` INTEGER, `Job` INTEGER, `BankBalance` INTEGER, `Weapon1` INTEGER, `Weapon1Ammo` INTEGER, `Weapon2` INTEGER, `Weapon2Ammo` INTEGER, `Weapon3` INTEGER, `Weapon3Ammo` INTEGER, `Weapon4` INTEGER, `Weapon4Ammo` INTEGER, `Weapon5` INTEGER, `Weapon5Ammo` INTEGER, `Weapon6` INTEGER, `Weapon6Ammo` INTEGER, `Weapon7` INTEGER, `Weapon7Ammo` INTEGER, `Weapon8` INTEGER, `Weapon8Ammo` INTEGER, `Weapon9` INTEGER, `Weapon9Ammo` INTEGER, `Weapon10` INTEGER, `Weapon10Ammo` INTEGER)");
    
strcat(str"`Weapon11` INTEGER, `Weapon11Ammo` INTEGER, `Weapon12` INTEGER, `Weapon12Ammo` INTEGER, `Weapon13` INTEGER, `Weapon13Ammo` INTEGER, `PRadio` INTEGER, `PRadioFreq` INTEGER, `CigarSticks` INTEGER, `WineBottles` INTEGER)"); 
Re edited the code but still crashes why?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)