Mysql query doing nothing ?
#1

phpMyAdmin shows no changes in my database no INSERT or CREATE, why ?
I checked my: host, database, pass and username and there all right.
PHP код:
//============================================================================//
//                                  Includes                                  //
//============================================================================//
#include <a_samp>
#include <a_mysql>
#include <zcmd>
#include <sscanf2>
//============================================================================//
//                                  Defines                                   //
//============================================================================//
#define host ""
#define user ""
#define pass ""
#define db ""
//============================================================================//
//                                  Main                                      //
//============================================================================//
main() {}
public 
OnGameModeInit() {
mysql_debug(1);
print(
"-------------------------------------------------------------");
print(
"        Game Mode Loaded!");
print(
"-------------------------------------------------------------");
mysql_connect(hostuserdbpass);
mysql_query("INSERT INTO `accounts` (username, password) VALUES ('Nickname', SHA('Pass'))");
if(
mysql_ping()) {
    print(
"Connection to database successful.");
} else if (!
mysql_ping()) {
    print(
"Connection to database failed.");
} else {
    print(
"Unknown error!");
}
return 
1;

Reply
#2

Did you even fill this up with your DB details ?
pawn Код:
#define host ""
#define user ""
#define pass ""
#define db ""
Reply
#3

Yes, i checked it 5 times now and there all right
Reply
#4

Quote:
Originally Posted by Dotayuri
Посмотреть сообщение
Yes, i checked it 5 times now and there all right
Do you have the table ? What does it say in mysql_log ? or debug or whatever you have ?
Reply
#5

yes i have the table and both are set to varchar 255.
all my programs say everythings ok
Reply
#6

Bump~
Can anyone help ? i tryied the mysql_query in phpMyAdmin and it worked:
PHP код:
"INSERT INTO `accounts` (username, password) VALUES ('Nickname', SHA('Pass'))" 
And i got:
PHP код:
Nickname and "d7cd56f2a2a3f47830760edfb89946eb7b9e2cd1" 
Reply
#7

Show mysql_log or debug or whatever you have.. maybe there's the problem
Reply
#8

Its telling me
PHP код:
(10060) (Error ID2003
I dont get it the info is all right
Reply
#9

Can't connect to host error

#sidenote:

pawn Код:
if(mysql_ping()) {
    print("Connection to database successful.");
} else if (!mysql_ping()) {
    print("Connection to database failed.");
} else {
    print("Unknown error!");
}
Boolean can have 2 states only: true, or false. So in fact you are doing something like
pawn Код:
if(true) { print("Cool"); }
else if(false) { print("NotCool"); }
else { printf("This will never happen"); }
Reply
#10

I took that off, i even copy and paste the info into fillezilla and it connects fine
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)