Mysql refuses to create table -
iFiras - 25.12.2017
pawn Код:
public OnPlayerConnect(playerid)
{
new string[128];
format(string, sizeof(string), "CREATE TABLE IF NOT EXISTS TABLENAME `terma`");
mysql_query(string);
return 1;
}
I have nothing but this code, I use BlueG's mysql server plugin r5 windows version
checked phpmyadmin a thousand times but table cant be created
could the plugin be causing this
and theres nothing in the logs
Re: Mysql refuses to create table -
DelK - 25.12.2017
Quote:
Originally Posted by iFiras
pawn Код:
public OnPlayerConnect(playerid) { new string[128]; format(string, sizeof(string), "CREATE TABLE IF NOT EXISTS TABLENAME `terma`"); mysql_query(string); return 1; }
I have nothing but this code, I use BlueG's mysql server plugin r5 windows version
checked phpmyadmin a thousand times but table cant be created
could the plugin be causing this
and theres nothing in the logs
|
try.
PHP код:
format(string, sizeof(string), "CREATE TABLE IF NOT EXISTS terma");
Re: Mysql refuses to create table -
iFiras - 25.12.2017
Still doesnt work
Re: Mysql refuses to create table -
MEW273 - 25.12.2017
Are you sure the database connection is being established correctly?
Re: Mysql refuses to create table -
iFiras - 25.12.2017
Quote:
Originally Posted by MEW273
Are you sure the database connection is being established correctly?
|
Logs tell me the connection to the database is successful
Re: Mysql refuses to create table -
MEW273 - 25.12.2017
You need to add the columns to your CREATE TABLE query, see example below:
Код:
CREATE TABLE IF NOT EXISTS `terma`(`ID`int AUTO_INCREMENT PRIMARY KEY)
Do you have debug enabled? If not you should enable and then check your MySQL log. As you're using a very outdated version of the MySQL plugin I'm not familiar with the functions but try this:
Place it before your connection code.
Also generally speaking I don't think it's worth the effort trying to create tables in Pawn, would it not be easier to simply create the table in phpMyAdmin?
Re: Mysql refuses to create table -
iFiras - 25.12.2017
Tried the first code, still didn't work
Enabled debug, didn't get anything
It always says connection to the database is successful
And I don't get how I should create the table manually, say I have a registration system, am I supposed to be creating a table for each player that registers manually?
Re: Mysql refuses to create table -
MEW273 - 25.12.2017
You should only need to create the
table once, you then add a new row when a player registers by using an INSERT query.
Even with debug enabled there is no log referencing this particular query? Could you post a copy of your MySQL log here please.
Re: Mysql refuses to create table -
iFiras - 25.12.2017
There is one log I found
pawn Код:
[12:03:40] [ERROR] mysql_connect: invalid option id '3306'
[12:04:24] [ERROR] mysql_connect: invalid option id '3306'
[12:04:55] [ERROR] mysql_connect: invalid option id '3306'
[12:07:17] [ERROR] mysql_connect: invalid option id '3306'
[12:08:18] [ERROR] mysql_connect: invalid option id '3306'
[12:09:34] [ERROR] mysql_connect: invalid option id '3306'
[12:18:01] [ERROR] mysql_connect: invalid option id '3306'
[12:23:39] [ERROR] mysql_connect: handle error: no database specified
[12:27:58] [ERROR] CConnection::CConnection - establishing connection to MySQL database failed: #1045 'Accиs refusй pour l'utilisateur: 'root'@'@localhost' (mot de passe: OUI)'
[12:27:58] [ERROR] CConnection::CConnection - establishing connection to MySQL database failed: #1045 'Accиs refusй pour l'utilisateur: 'root'@'@localhost' (mot de passe: OUI)'
[12:27:58] [ERROR] CConnection::CConnection - establishing connection to MySQL database failed: #1045 'Accиs refusй pour l'utilisateur: 'root'@'@localhost' (mot de passe: OUI)'
[12:27:58] [ERROR] CConnection::CConnection - establishing connection to MySQL database failed: #1045 'Accиs refusй pour l'utilisateur: 'root'@'@localhost' (mot de passe: OUI)'
But it doesn't seem that I got this now, in the time it says 12 pm but in my country its 2 pm now
and translation for the last lines, it says access refused to root@localhost (password: yes)
though it says connection to the database is successful in the samp-server log
Re: Mysql refuses to create table -
MEW273 - 25.12.2017
Stop your server then delete (or move to another folder) the log file completely, then start the server again, it will create a new log file and show only current errors.