[Tutorial] Basic MySQL Tutorial
#21

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.
Reply
#22

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

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);
Reply
#24

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.
Reply
#25

Added to the SA:MP Wiki
Reply
#26

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

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.
Reply
#28

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

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...
Reply
#30

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
Reply
#31

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

IDC I just want help with wampserver
Reply
#33

Help plz (soz for bump)
Reply
#34

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

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?
Reply
#36

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.
Reply
#37

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)
Reply
#38

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)