SA-MP Forums Archive
[Help]Creating Tables in PhpMyAdmin - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Help]Creating Tables in PhpMyAdmin (/showthread.php?tid=410646)



[Help]Creating Tables in PhpMyAdmin - Rohan_Ubhare - 26.01.2013

I'm new to MySql and PhpMyAdmin so I need help with creating tables. I use MySql and PhpMyAdmin from Volt-Host.

Код:
[04:58:33] >> mysql_query( Connection handle: 1 )
[04:58:33] CMySQLHandler::Query(SELECT `Username` FROM `accounts` WHERE `Username` = 'Rohan_Ubhare') - An error has occured. (Error ID: 1146, Table 'myDBname.accounts' doesn't exist)
So what to do now?

Thanks in Advance,
Rohan Ubhare


Re: [Help]Creating Tables in PhpMyAdmin - IgrexolonO - 26.01.2013

Well.. Umm. Why are you selecting Username, when you know Username? Near username add 'ID' table, and do it like this:

Код:
format(sqlquery, 24, "SELECT `id` FROM `accounts` WHERE `username`='%s'", pName_(playerid));
+

Код:
stock pName_(pid)
{
    new n[24];
    GetPlayerName(pid, n, 24);
    return n;
}
By this you can easily check if an account exist in database.


Re: [Help]Creating Tables in PhpMyAdmin - Rohan_Ubhare - 26.01.2013

Nw the script won't compile


Re: [Help]Creating Tables in PhpMyAdmin - IgrexolonO - 26.01.2013

Of course It won't. I just gave you a format function.

Код:
stock accExists(playerid)
{
    new sqlquery[100];
    format(sqlquery, 24, "SELECT `id` FROM `players` WHERE `login`='%s'", pName_(playerid));

    mysql_query(sqlquery);
    mysql_store_result();

    if(mysql_num_rows())
        return 1;

	mysql_free_result();

    return 0;
}
This is full function to see if player's acc exist.


Re: [Help]Creating Tables in PhpMyAdmin - Spooky - 18.04.2013

What you are trying to make btw?


Re: [Help]Creating Tables in PhpMyAdmin - Rohan_Ubhare - 18.04.2013

nvm -_- I no more use php/mysql. Thanks anyways