ctcp Posted December 15, 2009 Share Posted December 15, 2009 can sombady help me here ? <?php $UserID=''; $APIKey=""; $CharID=''; $XMLpath = "http://api.eve-online.com/char/WalletJournal.xml.aspx?userID=$UserID&apiKey=$APIKey&characterID=$CharID"; require_once('../header.php'); //for db info $con = mysql_connect($server, $user, $pw); mysql_select_db($db, $con); //********* The following 4 lines create the table. Obviously, this only needs to be run once and then commented out *********\ mysql_query("CREATE TABLE IF NOT EXISTS walletJournal ( ID int NOT NULL AUTO_INCREMENT, PRIMARY KEY (ID), refID int, date datetime, ownerName tinytext, ownerID int, amount int, reason tinytext, handled char(1) )", $con); function recursive_wallet_walk($XMLpath, $lastID) { if ($lastID) //if we have a lastID, request a journal walk (this is the recursive part of the function) $path = $XMLpath . "&beforeRefID=" . $lastID; else //just a normal query $path = $XMLpath; echo "Loading $path\n\n\n"; $s = simplexml_load_file($path); if (!$s)//url error { echo "Error: HTTP Error of some sort."; die(); } $curr_time = $s->currentTime; $expires_on = $s->cachedUntil; $expires_on_local = time() + (strtotime($expires_on) - strtotime($curr_time)); echo "File expires on: $expires_on_local\n"; $file=fopen("expiration.cache","w");//write the cached time file fwrite($file, "$expires_on_local"); fclose($file); if ($s->error != '') //error condition { echo "Error: " . $s->error; return; } foreach ($s->result->rowset->row as $entry) { $values = array(); foreach($entry->attributes() as $a => $b) //load all the entry's attributes into the values array { $values[$a] = mysql_real_escape_string($b); } if ($values[refTypeID] == 10) //reftypeID is 10 for a player donation { echo "In refID " . $values['refID'] . ", owner ". $values['ownerName1'] . ", userID " . $values['ownerID1'] . ", gave me " . $values['amount'] . " ISK for the reason: \"" . $values['reason'] ."\" on " . $values['date'] . "\n"; $result = mysql_query("SELECT * FROM walletJournal WHERE refID='{$values['refID']}'"); if (mysql_num_rows($result) > 0) { //This refID has already been stored... move along echo "got to a refID that's already been stored... we're outta' here"; return; } else { //this refID has not been stored, store it echo "Let's store this value!\n"; mysql_query("INSERT INTO walletJournal (refID, date, ownerName, ownerID, amount, reason, handled) VALUES ('{$values['refID']}','{$values['date']}','{$values['ownerName1']}','{$values['ownerID1']}','{$values['amount']}','{$values['reason']}', '0')"); } } } //we got to the end of the foreach array.... which means we have not gotten to a value that we've already seen! //we need to do the journal walking echo "-------====Doing a journal walk!===-------\n"; recursive_wallet_walk($XMLpath, $values['refID']); return; } recursive_wallet_walk($XMLpath, ''); ?> i don't have header.php what i need to write in header.php Quote Link to comment https://forums.phpfreaks.com/topic/185286-php-mysql-connect/ Share on other sites More sharing options...
mikesta707 Posted December 15, 2009 Share Posted December 15, 2009 ... firstly how are we supposed to know but yeah, you probably want to define the variables $server, $user, $pw, and $db as I don't see them defined anywhere, and that header.php has "db info" in it. Beyond that, I can't help A word of advice though.. I would learn PHP before you try to copy pasta scripts from the internet and make them work. Quote Link to comment https://forums.phpfreaks.com/topic/185286-php-mysql-connect/#findComment-978085 Share on other sites More sharing options...
ctcp Posted December 15, 2009 Author Share Posted December 15, 2009 <? $server = "XXX"; $user = "XXX"; $pw = "XXX"; ?> this is right? Quote Link to comment https://forums.phpfreaks.com/topic/185286-php-mysql-connect/#findComment-978093 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.