Jump to content

[SOLVED] need a little help


Jiraiya

Recommended Posts

yes i do mean changing a database variable but im not sure how to write the scritp here is what i have so far

 

 



$username = $_COOKIE['ID_my_site']; 
$sql = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());




if($skill >= 5000000)
{
$rank = Akatsuki;
}


?>

Link to comment
Share on other sites

Based on that script, you don't know the basic handling of MySQL stuff in PHP....

 

You should really look into it, but I'll just go ahead and tell you:

 

 

 

<?php
$username = $_COOKIE['ID_my_site'];  //You shouldn't trust cookies!  You need to atleast escape this data, and if it's used as authentication data, that's a big no-no.
$sql = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
if($r = mysql_fetch_assoc($sql)) {
    $skill = $r['skill'];
    if($skill >= 5000000) {
        //$rank = Akatsuki;
        //Unless Akatsuki is a constant, it should be in quotes.
        $rank = 'Akatsuki';
    }
}


?>

Link to comment
Share on other sites

is this rite for updating the rank variable?

 

 

 

$username = $_COOKIE['ID_my_site']; 
$sql = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
if($r = mysql_fetch_assoc($sql)) {
    $skill = $r['skill'];
    if($skill >= 5000000) {
        //$rank = Akatsuki;
        //Unless Akatsuki is a constant, it should be in quotes.
        $rank = 'Akatsuki';

$query = "UPDATE users rank = '$rank=Akatsuki";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.