SA-MP Forums Archive
[Tutorial] Basic MySQL Tutorial - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Tutorial] Basic MySQL Tutorial (/showthread.php?tid=129183)

Pages: 1 2 3


Re: [Tutorial] Basic MySQL Tutorial - Faraday - 21.03.2010

Quote:
Originally Posted by |)ЂΩ†{−}ЂR™ – Dare To Die
Mna, mysql_query shows aregument mismatch -

Code:
mysql_query("INSERT INTO 'users' ('name', 'pass') VALUES ('%s', MD5('%s'))",PName, inputtext);
Ah yes, that's a mistake from my part. You'll have to format a string first..
Code:
new string[256];
format(string,sizeof(string,"INSERT INTO `users` (`name`, `pass`) VALUES ('%s', MD5('%s'))",PName,inputtext);
mysql_query(string);
That will do it. Also fixed in the Original post.


Re: [Tutorial] Basic MySQL Tutorial - Torran - 21.03.2010

I tried following this error, I couldnt get it to work for registering ect


Re: [Tutorial] Basic MySQL Tutorial - Carlton - 21.03.2010

Quote:
Originally Posted by Faraday
Quote:
Originally Posted by |)ЂΩ†{−}ЂR™ – Dare To Die
Mna, mysql_query shows aregument mismatch -

Code:
mysql_query("INSERT INTO 'users' ('name', 'pass') VALUES ('%s', MD5('%s'))",PName, inputtext);
Ah yes, that's a mistake from my part. You'll have to format a string first..
Code:
new string[256];
format(string,sizeof(string,"INSERT INTO `users` (`name`, `pass`) VALUES ('%s', MD5('%s'))",PName,inputtext);
mysql_query(string);
That will do it. Also fixed in the Original post.
You missed a parentheses, fixed it.

pawn Code:
new string[MAX_PLAYER_NAME + 128];
format(string,sizeof(string),"INSERT INTO `users` (`name`, `pass`) VALUES ('%s', MD5('%s'))",PName,inputtext);
mysql_query(string);



Re: [Tutorial] Basic MySQL Tutorial - Norn - 22.03.2010

Quote:
Originally Posted by AndrewP
Quote:
Originally Posted by Faraday
Quote:
Originally Posted by DavidC
Great tutorial, although I think it might be worth mentioning mysql_real_escape_string for things like passwords and other user inputted strings.
Since I haven't used mysql_real_escape_string, can you explain it to me? If it's really important to know, I can add it to the tutorial.
Not really important to know, since I don't think it's possible to SQL inject through SA-MP. But it's a function in PHP that allows a person to protect a form from SQL injection (a form of hacking where a hacker can use a SQL query to withdraw data from the database). And I have a suggestion:
Code:
mysql_query("SELECT `password` FROM `users` WHERE `username` = '%s'",PlayerName);
They'll have to MD5 hash the string that they are comparing it to so it compares correctly. I think you should mention that.

Thanks
Of course it is if they change there password string they could use it to sql inject.


Re: [Tutorial] Basic MySQL Tutorial - Faraday - 30.03.2010

Added to the SA:MP Wiki


Re: [Tutorial] Basic MySQL Tutorial - kingforyou - 30.03.2010

When i click myphpadmin in wamp server the page doesnt open its says page cannot be found


Re: [Tutorial] Basic MySQL Tutorial - Faraday - 30.03.2010

Quote:
Originally Posted by kingforyou
When i click myphpadmin in wamp server the page doesnt open its says page cannot be found
keep trying, or reinstall wampserver.. It should work normally.


Re: [Tutorial] Basic MySQL Tutorial - kingforyou - 30.03.2010

i did it is this metter is i havr router or not open ports or any other shit ?


Re: [Tutorial] Basic MySQL Tutorial - Befire - 17.06.2010

Tutoriel MYSQL (In french):

For PHPMyAdmin : http://www.siteduzero.com/tutoriel-3...hpmyadmin.html
For each mysql(); : http://www.siteduzero.com/tutoriel-3...s-donnees.html

PS : That's a tutoriel to learn the PHP...


Re: [Tutorial] Basic MySQL Tutorial - [DRD]Rodney - 04.08.2010

I can open wampserver, but i don't find phpmyadmin anywhere. ( talking about icon >> down)

Only options I got (icon >> down): about, refresh, help, language and exit


Re: [Tutorial] Basic MySQL Tutorial - WackoX - 04.08.2010

* It isn't posted in the tutorial section.
* Rip-off? https://sampforum.blast.hk/showthread.php?tid=160971


Re: [Tutorial] Basic MySQL Tutorial - [DRD]Rodney - 05.08.2010

IDC I just want help with wampserver


Re: [Tutorial] Basic MySQL Tutorial - [DRD]Rodney - 05.08.2010

Help plz (soz for bump)


Re: [Tutorial] Basic MySQL Tutorial - vital2k - 05.08.2010

In your browser type: localhost/phpmyadmin see if that works. Not sure because I haven't used WAMP in ages.


Re: [Tutorial] Basic MySQL Tutorial - [DRD]Rodney - 05.08.2010

Thx, says I need pass (I already used MS-DOS to login a few times, nothing to do there)

How i login on this web?


Re: [Tutorial] Basic MySQL Tutorial - vital2k - 05.08.2010

Urm it's been a very long time since i used it but i seem to remember having to set up a username and password for the database.


Re: [Tutorial] Basic MySQL Tutorial - [DRD]Rodney - 05.08.2010

I have not even created a database, I only managed to login on MS-DOS via

C:\mysql root -u pass
Or something simular to that.

EDIT: my error was

#1045 - Access denied for user 'root'@'localhost' (using password: NO)


Re: [Tutorial] Basic MySQL Tutorial - vital2k - 05.08.2010

Okay, might be a good idea to search wamp server setup tutorials or something on ******. There are a few around.


Re: [Tutorial] Basic MySQL Tutorial - [DRD]Rodney - 05.08.2010

Yeah but they seem to have a whole diffrent control panel.


Re: [Tutorial] Basic MySQL Tutorial - vital2k - 05.08.2010

Maybe it's the version of WAMP you DL'd?