MySQL - Getting Started
#1

Right, I decided to have a go at MySQL, I looked at omse tutorials but non of them go as far as I need them to do. Basically Im up to here:

I installed wamp.

I created car saving database:


And added this in my gamemode:
pawn Код:
#include <mysql>
forward ConnectMySQL();
public ConnectMySQL()
{
    mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);

    if(mysql_ping() == 1)
    {
      //  mysql_debug(1);
        printf("[MYSQL]: Connection to `%s` succesful!", SQL_DB);
    }
    else
    {
        printf("[MYSQL]: [ERROR]: Connection to `%s` failed!", SQL_DB);
    }
    return 1;
}
And now, I need some code for public SaveCar, public LoadCar, so it saves those functions in to that database or however it works and the it loads them, so please someone help me out. Thx.

((Also IDK if I used correct setting in my DB, I used float for the parameters that USE float, for everything else I used INS, is thar right or does that need changing?))
Reply
#2

I got everything sorted out, Just my server turns off when I start it.

Код:
[Sat Dec 31 09:55:39 2011] -------------------------
[Sat Dec 31 09:55:39 2011]      Logging Started
[Sat Dec 31 09:55:39 2011] -------------------------
[Sat Dec 31 09:55:40 2011] Error (0): Failed to connect. Can't connect to MySQL server on 'localhost' (10061).
[Sat Dec 31 09:55:40 2011] Error (0): Function: mysql_close called when not connected to any database. Can't connect to MySQL server on 'localhost' (10061).
[Sat Dec 31 09:55:40 2011] -------------------------
[Sat Dec 31 09:55:40 2011]       Logging Ended
[Sat Dec 31 09:55:40 2011] -------------------------
Reply
#3

Check that you have the correct username password and host.
Also remember to open up wamp as you have to manually start it always when you boot up your computer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)