-
Posts
271 -
Joined
-
Last visited
Everything posted by blacknight
-
what is the full syntax error?
-
select * from `T2` AS T2 JOIN `T1` AS T1 ON `T2`.`apn`=`T1`.`apn` ORDER BY `T2`.`update_date` DESC Limit 1; try that
-
select * from `T1` AS T1 JOIN `T2` AS T2 ON `T1`.`apn`=`T2`.`apn` and depending on what your date for mat is ORDER BY `T2`.update_date` SESC
-
conect php with mysql in order to upload image
blacknight replied to bonito1's topic in Third Party Scripts
insted of using is_uploaded_file try using move_uploaded_file($_FILES['image']['tmp_name'], $target_path)) $target_path would be where it is stored on the server this will also pass a true or false if the file uploads the db query should go thru at that point... -
How do they know the image is the right one?
blacknight replied to 3raser's topic in PHP Coding Help
probably based on image size and w/h settings -
ok dude your gona get some help ... one thing ial let yea know my swl when your doing some thing your have to be exact when your doing select statements... when using "Select `cat`.`id`" you have to define every field you wana call in the query here from all tables just so you know.... so from what i have gathered you have 5 tables 'categories' 'features' 'product_features' 'phone_features' 'products' so here is what i think you are trying to do.... SELECT `cat`.`id` , `cat`.`name`, `cat`.`imagethumb` FROM `categories` AS cat LEFT JOIN `features` AS f ON `f`.`id` = `cat`.`id` LEFT JOIN `product_features` AS prf phf`.`id` = `prf`.`id` = `f`.`id` LEFT JOIN `phone_features` AS phf ON `phf`.`phone_id` = $phone_id LEFT JOIN `products` AS p ON `p`.`cat_ids` = `cat`.`id` WHERE [i]your where statement here[/i] what this does so you can make any changes you need to do .... " FROM `categories` AS cat" defines the catagorie table as `cat` so this is used for all table ref's that your gona have ... "LEFT JOIN `features` AS f ON `f`.`id` = `cat`.`id`" this joins features ref as "f" with catagories On (where basicly) f.id=cat.id now at the end of my code is where your where statement would go... i hope tjhis helps you out cheers
-
Hey all long time no post lol so im working on improving this RosterAPI Josh Grochowski made and im adapting it for use with a nother site my issue is this i have to get data from an html file the data i wana collect in nested like this <div class="talentcalc-info"> <div class="third-party"> <a href="javascript:;" data-fansite="talentcalc|paladin|000000000000000000003202322312112110022000000000000000000000" class="fansite-link "> </a> </div> <div class="export" style="display: none"><a href="#">Export</a></div> <div class="calcmode"><a href="javascript:;">Calculator mode</a></div> <div class="restore" style="display: none"><a href="javascript:;">Restore</a></div> <div class="reset" style="display: none"><a href="javascript:;">Reset</a></div> <div class="pointsspent" style="display: none"><span class="name">Points spent:</span><span class="value"><span>0</span><ins>/</ins><span>30</span><ins>/</ins><span>0</span></span></div> <div class="pointsleft" style="display: none"><span class="name">Points left:</span><span class="value">0</span></div> <div class="requiredlevel" style="display: none"><span class="name">Required level:</span><span class="value">-</span></div> </div> being that "talentcalc|paladin|000000000000000000003202322312112110022000000000000000000000" is the data i wana retrive i have tryed query('.//div[@class="talentcalc-info"]/div[@class="third-party"]/a'); but im getting no where fast any ideas guys?
-
nm think i have it now...
-
im using the code $ch = curl_init(); $timeout = 30; // set to zero for no timeout $useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1"; curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt ($ch, CURLOPT_USERAGENT, $useragent); $f = curl_exec($ch); curl_close($ch); $xml = simplexml_load_string($f, 'SimpleXMLElement', LIBXML_NOCDATA); to pull xml data from a website and the array im getting has @attributes as a key header.. like this SimpleXMLElement Object ( [@attributes] => Array ( [categoryId] => 92 [dateCompleted] => 2009-02-12-07:00 [desc] => Sample 50 different kinds of Azeroth's delectable dishes. [icon] => inv_misc_food_115_condorsoup [id] => 1832 [points] => 10 [title] => Tastes Like Chicken ) [criteria] => SimpleXMLElement Object ( [@attributes] => Array ( [maxQuantity] => 50 [quantity] => 53 ) ) ) and i cant get this data out of the array i have tryed everything but nothing is working ... any one have any ideas...
-
wow a lot of help ive since solved this issue and moved to a nother one im trying to repair a script for the wow roster comunity called armory sync and i am getting more issues with regex imformation is stored in an ahtml array that looks like this <div class="(VAL1)"> <div class="rep-lbg"> <div class="rep-lr"> <div class="rep-ll"> <ul> <li class="faction-name"> <a class="staticTip" href="(VAL3)" onMouseOver=" setTipText('Click here to learn more about this faction');" target="_blank">(VAL4)</a> </li> <li class="faction-bar"> <a class="rep-data">(VAL5)</a> <div class="bar-color" style=" width: 12%"></div> </li> <li class="faction-level"> <p class="rep-icon">(VAL6)</p> </li> </ul> </div> </div> </div> </div> And i have tryed to get this to work with all the codes pasted here for me and i got nothing .... there are 10-35 groups of lines like this in the array so i need everything to match indexes in arrays so i can store the data any help would be awsome guys
-
think i got it i wanted to array it all togeather but preg_match_all('/\(?[0-9]{2}[-. ]?[0-9]{2}[-. ]?[0-9]{4}\)/', $text, $match5); is grabbing the date for me
-
this is verry close to what i need it is grabing the wright info from the statement but there are 5 statements like this and the info is never allways the same i used preg_match_all('|class="s_ach_stat">(?<points>\d+)|', $text, $match4); echo '<pre>'; print_r($match4); to get the points but the date where it is in brackets is still giving me issues.
-
ok i am pulling <div class="s_ach_stat">10<img src="../images/achievements/tiny_shield.gif"> (01-13-2009) </div> <span>Explore Storm Peaks</span><span class="achv_desc">Explore Storm Peaks, revealing the covered areas of the world map.</span> from a web page in this example i want to pull "10" "01-13-2009" "Explore Storm Peaks" "Explore Storm Peaks, revealing the covered areas of the world map." from the text using preg_match_all('|<span>(.+?)</span><span class="achv_desc">(.+?)</span>|', $text, $match3); i can get Array ( [0] => Array ( [0] => Explore Howling FjordExplore Howling Fjord, revealing the covered areas of the world map. [1] => Explore Borean TundraExplore Borean Tundra, revealing the covered areas of the world map. [2] => Explore DragonblightExplore Dragonblight, revealing the covered areas of the world map. [3] => Explore Storm PeaksExplore Storm Peaks, revealing the covered areas of the world map. [4] => The Green Hills of StranglethornComplete all of Hemet Nesingwary quests in Stranglethorn Vale up to and including The Green Hills of Stranglethorn and Big Game Hunter. ) [1] => Array ( [0] => Explore Howling Fjord [1] => Explore Borean Tundra [2] => Explore Dragonblight [3] => Explore Storm Peaks [4] => The Green Hills of Stranglethorn ) [2] => Array ( [0] => Explore Howling Fjord, revealing the covered areas of the world map. [1] => Explore Borean Tundra, revealing the covered areas of the world map. [2] => Explore Dragonblight, revealing the covered areas of the world map. [3] => Explore Storm Peaks, revealing the covered areas of the world map. [4] => Complete all of Hemet Nesingwary quests in Stranglethorn Vale up to and including The Green Hills of Stranglethorn and Big Game Hunter. ) ) but i cant get the "10" or the "01-13-2009" one issue is because of the () in the statement.. i hope this is clearer
-
working on a site for a wow guild trying to get some info from a page <div class="s_ach_stat">10<img src="../images/achievements/tiny_shield.gif"> (01-13-2009) </div> <span>Explore Storm Peaks</span><span class="achv_desc">Explore Storm Peaks, revealing the covered areas of the world map.</span> </div>[code] is exactly how it appears in the page source my problem is the () in the statement are throwing it off i can get [code]<span>Explore Storm Peaks</span><span class="achv_desc">Explore Storm Peaks, revealing the covered areas of the world map.</span> to phase out to an array but (01-13-2009) still causes me some issues any ideas guys?
-
im working on a website for my wow guild and i want to import achivements to our site i need a code to read xml data from the wowarmory and then place it in a array so it can be increted to a database the url im trying to get working is "http://www.wowarmory.com/character-achievements.xml?r=Zangarmarsh&n=Ulminia&c=96" any help would be awsome thanks...
-
i managed to fix it some how Oo this is what i used $text = nl2br(trim($row['text'])); $news = ''; $lines = explode("\\r\\n", $text); $i = 0; foreach ($lines as $line) { $i++; $line = str_replace("\r\n", '<br>', $line); $news .= $line.'<br>'; }
-
ok i have a website where i post new on it when i send the new to sql i get \r\n carriage return and new line ussie being.. i have tryed avery thing and i mean every thing to remove these explode preg str you name it ive tryed it and i cannot get them out and just replace them with a simple <br> any one have any ideas at all... and i have tryed nl2br(mysql_real_escape_string(htmlentities( no luck ither i ended up with \\r\\n and still cant remove them .....
-
Getting line data with highest number in specified collum
blacknight replied to blacknight's topic in PHP Coding Help
worked i guess i was tryen to make it more diffacult then it was i was tryen to use the MAX() function lol -
it wont return the data like it should really i havent used this type of code much the page has numerical values on it and i want to get them on to my page to put them in a database. The phrase "Total Characters:" is in a table and looks like <tr> <td class="category">Total Characters:</td> <td><b>9,352</b></td> </tr> this i am trying to return the number 9,352 and its not worken..
-
im looking for a way to get info from a html page in php i have a code that was sapose to work but no longer does any one have any ideas on how to make it work? here is the code <?php $realmstatus = utf8_decode('Total Characters:'); $realmstatus = trim($realmstatus); $url = 'http://www.warcraftrealms.com/census.php?serverid=802&factionid=-1&minlevel=1&maxlevel=70&servertypeid=1'; $current_time = date('i')*1; if (function_exists('curl_init')) { $fp = curl_init( $url ); curl_setopt($fp, CURLOPT_HEADER, 0); curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1); $html = curl_exec($fp); if ( curl_errno($fp) ) { $ch_err = 1; } else { $ch_err = 0; } curl_close($fp); } else { $html = @file_get_contents($url); } //==========[ HTML PARSER ]============================================================ if (isset($html) && $html) { if (!preg_match('/\<tr(.(?!\<tr))*('.str_replace("'",''',$realmstatus).')(.(?!\<\/tr))*/si',$html,$matches)) { $err = 1; } elseif (preg_match_all('/^.*color: #([0-9a-fA-F]+);\">([^<]*)/m',$matches[0],$row) != 3) { $err = 1; } //print_r($row); //die(); } else { $err = 1; } ?>
-
well i got it solved lol changed my code a lil if (array_key_exists ('Title',$guildRanks)){ $rnk = $guildRanks[$char['Rank']]['Title']; }else{ $rnk = $guildRanks[$char['Rank']]; } since one array dosent use the Title key this figures witch way to update the rank name lol
-
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
-
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
-
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); } } }