Jump to content

[SOLVED] need a little help


Jiraiya

Recommended Posts

Perhaps page 9 of CV's tutorial might be helpful:

http://www.phpfreaks.com/tutorial/php-custom-list-order/page9

 

Otherwise you may need to show some code/an example so we can specifically see what needs to be changed?  I'm assuming you mean changing a database variable?

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;
}


?>

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';
    }
}


?>

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";

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.