05.08.2009, 17:31
Quote:
Originally Posted by Anarkien
Quote:
First of all.. Why are you using `players`.`id`. And won't this only update "ID 1"'s job?? You should make your control panel so that the users can't be in-game while trying to edit their stats, like their job. Rather do something like this: Your in-game name is Che_Guevara. You go to the UCP and write in Che_Guevera + your username in order to log in. In the UCP you'll be able to change your job with a certain "job id". job id 1 = farmer job id 2 = police etc.. Get the session ID from the login (which should be "Che_Guevara"). Like.. $_SESSION['user'], or whatever your session is called. Eventually you can just do: $username = $_POST['username'] in order to get the username (Che_Guevara) written from the database. Then the $username will be a variable which holds the $_POST. Now, when the user tries to update, is should be something like this: Код:
<?php require_once("config.php"); $sql = "UPDATE `samp`.`players` SET `Job` = \'0\' WHERE `player`.`name` = '$username' LIMIT 1;"; ?> And by the way, this script will make the job ID 0. By replacing "0" with "$jobid" or something similar, you can allow the user to write the job ID themselves through a form. I guess this became a pretty long post, and if you don't have any experience in MySQL, it might be a bit hard to understand what I mean. |
Im sure i have it trying to conect my IP and right database, and username is right and i have blank password because i dont have password. But i get denied the connection to database.