Jump to content

blacknight

Members
  • Posts

    271
  • Joined

  • Last visited

Posts posted by blacknight

  1. if (isset($guildRanks[$char['Rank']]['Title'])){
    	$rnk = $guildRanks[$char['Rank']]['Title'];
    	}else{		
                $rnk = $guildRanks[$char['Rank']];

     

    is designed to compare aganst 2 arrays one witch contains a "["Title"]" veriable and one that dosent and uses the correct veriable it all works fine as far as the array and the structure just when i go from echoing for example "$guildRanks[$char['Rank']]" and $char['Rank'] = 0 i get President on the echo but then when its inserted in to the database i just get the letter p insted of the Full name and i dono y this is my problem

  2. Array
    (
        [1] => Vice President
        [2] => General
        [3] => Class Colonel
        [4] => Raid Colonel
        [5] => Class Captain
        [6] => Leiutenant
        [7] => First Sergeant
        [8] => Sergeant
        [9] => Private
        [0] => President
    )
    
    
    

     

    is the array data and thay are stored in varchar 255 so i dono y its not worken man oh and $char['Rank'] is there rank in number from 0-9

  3. whole code that uses the given array

     

    	function update_guild_member( $guildId, $name, $char, $currentTimestamp, $guildRanks )
    {
    	$name_escape = $this->escape( $name );
    
    	$querystr = "SELECT `member_id` FROM `".ROSTER_MEMBERSTABLE."` WHERE `name` = '$name_escape' AND `guild_id` = '$guildId'";
    	$result = $this->query($querystr);
    	if( !$result )
    	{
    		$this->setError('Member could not be selected for update',$this->error());
    		return;
    	}
    
    	$memberInfo = $this->fetch_assoc( $result );
    	if ($memberInfo)
    		$memberId = $memberInfo['member_id'];
    
    	if (isset($guildRanks[$char['Rank']]['Title'])){
    	$rnk = $guildRanks[$char['Rank']]['Title'];
    	}else{		
                $rnk = $guildRanks[$char['Rank']];
                }
                //print $rnk;
    	$this->closeQuery($result);
    
    	$this->reset_values();
    
    	$this->add_value( 'name', $name_escape);
    	$this->add_value( 'class', $char['Class']);
    	$this->add_value( 'level', $char['Level']);
    	if( isset($char['Note']) )
    		$this->add_value( 'note', $char['Note']);
    	else
    		$this->add_value( 'note', '');
    	$this->add_value( 'guild_rank', $char['Rank']);
    	$this->add_value( 'guild_title', $rnk);
    	if( isset($char['OfficerNote']) )
    		$this->add_value( 'officer_note', $char['OfficerNote']);
    	else
    		$this->add_value( 'officer_note', '');
    	$this->add_value( 'zone', $char['Zone']);
    	if( isset($char['Status']) )
    		$this->add_value( 'status', $char['Status']);
    	else
    		$this->add_value( 'status', '');
    	$this->add_time( 'update_time', getDate($currentTimestamp));
    
    	if( $char['Online'] == '1' )
    	{
    		$this->add_value( 'online', 1 );
    		$this->add_time('last_online', getDate($currentTimestamp));
    	}
    	else
    	{
    		$this->add_value( 'online', 0 );
    		list($lastOnlineYears,$lastOnlineMonths,$lastOnlineDays,$lastOnlineHours) = explode(':',$char['LastOnline']);
    
    		# use strtotime instead
    		#      $lastOnlineTime = $currentTimestamp - 365 * 24* 60 * 60 * $lastOnlineYears
    		#                        - 30 * 24 * 60 * 60 * $lastOnlineMonths
    		#                        - 24 * 60 * 60 * $lastOnlineDays
    		#                        - 60 * 60 * $lastOnlineHours;
    		$timeString = '-';
    		if ($lastOnlineYears > 0)
    			$timeString .= $lastOnlineYears.' Years ';
    		if ($lastOnlineMonths > 0)
    			$timeString .= $lastOnlineMonths.' Months ';
    		if ($lastOnlineDays > 0)
    			$timeString .= $lastOnlineDays.' Days ';
    		$timeString .= max($lastOnlineHours,1).' Hours';
    
    		$lastOnlineTime = strtotime($timeString,$currentTimestamp);
    		$this->add_time( 'last_online', getDate($lastOnlineTime) );
    	}
    
    	if( $memberId )
    	{
    		$querystr = "UPDATE `".ROSTER_MEMBERSTABLE."` SET ".$this->assignstr." WHERE `member_id` = '$memberId' AND `guild_id` = '$guildId'";
    		$this->setMessage('<li>[ '.$name.' ]</li>');
    		$this->membersupdated++;
    
    		$result = $this->query($querystr);
    		if( !$result )
    		{
    			$this->setError(''.$name.' could not be inserted',$this->error());
    			return;
    		}
    	}
    	else
    	{
    		// Add the guild Id first
    		if( !empty($guildId) )
    			$this->add_value( 'guild_id', $guildId);
    
    		$querystr = "INSERT INTO `".ROSTER_MEMBERSTABLE."` SET ".$this->assignstr;
    		$this->setMessage('<li><span class="green">[</span> '.$name.' <span class="green">] - Added</span></li>');
    
    		$result = $this->query($querystr);
    		if( !$result )
    		{
    			$this->setError(''.$name_escape.' could not be inserted',$this->error());
    			return;
    		}
    
    		$querystr = "SELECT * FROM `".ROSTER_MEMBERSTABLE."` WHERE `guild_id` = '$guildId' AND `name` = '$name_escape' AND `class` = '".$char['Class']."';";
    		$result = $this->query($querystr);
    		if( !$result )
    		{
    			$this->setError('Member could not be selected for MemberLog',$this->error());
    		}
    		else
    		{
    			$row = $this->fetch_array($result);
    			$this->setMemberLog($row,1);
    		}
    	}
    }

  4. ok i have an array that deines things by number fro example

     

    array(

    {1] = "NooB",

    [2] = "Expert"

    )

     

    but then its sapose to be inserted in to the database all i get is the first lettera nd i have no i dea why this is happaning because i can echo the same value and it shows as the fill value any ideas or help please

  5. ok i need help i have a page i have coded and i have made a newer version and added collums to the table how would i go about comparing the 2 tables colums and adding the missing collums to a array to be used in an alter table query this is the old structure

    [code]            CREATE TABLE `tablename`
                `id` int(11) NOT NULL auto_increment,
                `file` varchar(255) NOT NULL default '',
                `caption` varchar(255) NOT NULL default '',
                `ext` varchar(255) NOT NULL default '',
                `catagory` varchar(255) NOT NULL default '',
                `approve` varchar(3) NOT NULL default '',
                PRIMARY KEY  (`id`)
                ) [/code]
    and this si the new one
    [code]            CREATE TABLE `".ROSTER_SCREENTABLE."` (
                `id` int(11) NOT NULL auto_increment,
                `file` varchar(255) NOT NULL default '',
                `caption` varchar(255) NOT NULL default '',
                `ext` varchar(255) NOT NULL default '',
                `catagory` varchar(255) NOT NULL default '',
                `approve` varchar(3) NOT NULL default '',
                `votes` varchar(10) NOT NULL default '',
                `rateing` varchar(10) NOT NULL default '',
                PRIMARY KEY  (`id`)
                ) [/code]

    any help guys
  6. im tryingt to make an upgrade script for a database and need to see if spacific colums are present in the table i have tryed

    [code]$sql_str = "SHOW COLUMNS FROM table_name LIKE 'approved'";
    $this->setSqlDebug("checkcolumDb: $sql_str");
          $result = $wowdb->query($sql_str);
          if ($wowdb->num_rows($result) == 0){
          echo "no colum";
          $t++;
         
          }[/code]
    but no column is allways echoed if it exists or not i need tit to not return if it does any one have any help?
  7. we have a database where we store computer parts and we use these parts to build systems this is what i need to know say i have somthen like this

    video card x 10
    mobo        x 5
    Ram        x 7
    Hdd          x 9

    no by looking at this i can see that i can make 5 systems but i was a php script that compares up to 10 compoments and tells me how many i can make can some one help me with this?
  8. yes i understand the numbers axualt represent money being 9999 gold peaces 99 sulver and 99 bronze being the most someone can get and 1 bronze being the least i will see what i can figure out from the code given to me...
  9. ook we finaly hit a snage when a veriiable id 4 characters or less it automaticalyt asumes its all one number is there a fix for teis
    so
    5525 reads as 55 25 not 5525 as the first number where 55 should be the second and 25 the 3rd and the 1st being empty?
  10. ok i need to format a number string foing from the right say example
    62500 need to be formated to 6 25 00 reasion for being this is for a game site where the 00 is lesser then the 25 and the 6 can go as high as 9999 any ideas?
×
×
  • 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.