Jump to content

Tjorriemorrie

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

About Tjorriemorrie

  • Birthday 08/04/1982

Contact Methods

  • Website URL
    http://tjorriemorrie.freewebhosty.com/index.html

Profile Information

  • Gender
    Male
  • Location
    South Africa

Tjorriemorrie's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks Arne, I'll have to check that. I got it working as 'lastUpdate'. Weird. Also, the value should be long, therefore it should not be date('r', $blog->date) but just $blog->date. Thanks for the reply. Tjorriemorrie
  2. Hey, I'm trying to build my own feed after the user has created or edited a post. However, even though I set the pubDate in the entries, Zend still goes and overwrite it with the current timestamp, even worse the timestamp is in the wrong timezone Can anyone help me figure out how to set the pubDate of the entries as per the date of the data? private function setXml() { function cmpEntries($a , $b) { $a_time = strtotime($a['pubDate']); $b_time = strtotime($b['pubDate']); if ($a_time == $b_time) { return 0; } return ($a_time > $b_time) ? -1 : 1; } $entries = array(); $blogDb = new Model_Blog(); $blogs = $blogDb->getAllBlogs(); foreach ($blogs as $blog) { $entry = array( 'title' => $blog->title, 'link' => 'http://www.aviyacrest.com/index/blog/entry/' . $blog->id, 'description' => htmlentities(nl2br($blog->description)), 'pubDate' => date('r', $blog->date) ); array_push($entries, $entry); } $poemsDb = new Model_Poem(); $poems = $poemsDb->getAllPoems(); foreach ($poems as $poem) { $entry = array( 'title' => $poem->title, 'link' => 'http://www.aviyacrest.com/index/poems/entry/' . $poem->id, 'description' => 'New poem from Aviya.', 'pubDate' => date('r', $poem->date) ); array_push($entries, $entry); } usort($entries, 'cmpEntries'); $feed = array( 'title' => 'Aviya', 'link' => 'http://www.aviyacrest.com', 'charset' => 'UTF-8', 'entries' => $entries ); $rss = Zend_Feed::importArray($feed, 'rss'); $rssFeed = $rss->saveXML(); try { $fh = fopen(PUBLIC_PATH . '/blog.xml', 'w'); fwrite($fh, $rssFeed); fclose($fh); return true; } catch (Zend_Exception $e) { $this->message = $e->getMessage(); return false; } } Here's an extract of the xml file: <item> <title><![CDATA[Fragile]]></title> <link>http://www.aviyacrest.com/index/blog/entry/21</link> <description><![CDATA[understand others by understanding yourself]]></description> <pubDate>Thu, 11 Jun 2009 13:15:31 +0000</pubDate> </item> <item> <title><![CDATA[We have done the same]]></title> <link>http://www.aviyacrest.com/index/poems/entry/17</link> <description><![CDATA[New poem from Aviya.]]></description> <pubDate>Thu, 11 Jun 2009 13:15:31 +0000</pubDate> </item>
  3. Hey, I just switched to phpDesigner 2008. I opened my project folder which is using the zend framework and i got these errors: Warning: strpos() [function.strpos]: Empty delimiter in C:\wamp\www\thelivingtree\library\Zend\Controller\Request\Http.php on line 493 this one happened 3 times. code: if (0 === strpos($requestUri, $baseUrl)) { // full $baseUrl matches $this->_baseUrl = $baseUrl; return $this; } if (0 === strpos($requestUri, dirname($baseUrl))) { // directory portion of $baseUrl matches $this->_baseUrl = rtrim(dirname($baseUrl), '/'); return $this; } if (!strpos($requestUri, basename($baseUrl))) { // no match whatsoever; set it blank $this->_baseUrl = ''; return $this; } and Zend_Session_Exception: Session must be started before any output has been sent to the browser; output started in C:\wamp\www\thelivingtree\library\Zend\Controller\Request\Http.php/493 in C:\wamp\www\thelivingtree\library\Zend\Session.php on line 419 this seems to be errors phpDesigner gives with the library of the zend framework. Anybody know how to get around these?
  4. Sorry, can you please explain that to me a bit more, I'm still stuck
  5. Hey, as the title says, my images doesn't show in the browser. I'm saving the absolute path of the images in my database (using absolute as I'm testing locally using wamp). When i put those paths in an img tag, the image doesn't show. IE doesn't show the red 'broken link' cross, but the image placeholder icon, so I'm not sure why it just doesn't show the picture. Here is the code: <?php echo "<p>Name: " . $left["picpath"] . "</p>\r\n"; echo "<p>Size: " . $left["picsize"] . "</p>\r\n"; echo "<p><img src=\"" . $left["picpath"] . "\" /></p>\r\n"; print_r($left); ?> Here is its page source: <p>Name: F:\pictures other\art\22903721.jpg</p> <p>Size: 97812</p> <p><img src="F:\pictures other\art\22903721.jpg" /></p> Array ( [id] => 1518 [picpath] => F:\pictures other\art\22903721.jpg [picsize] => 97812 [picstats] => [lastupdate] => 0000-00-00 00:00:00 ) Any help appreciated!
  6. Hey, if anyone can please check my code for me. I want to update a record, i select the entry from the list, but when i click the button, no post values exist. No errors, and it's not updated. Here's the code to update (at top of file): It updates the one record setting one field as the id of another field (as the followup or required) and does the reverse for the other record involved. // ========== UPDATE RECORD ========== if ($_POST['Submit'] == 'Set required' || $_POST['Submit'] == 'Set followup') { // Get parameters from form $id = $questID; $questToSetID = $_POST['questToSet']; // Do update statement if ($_POST['Submit'] == 'Set required') { $query = "UPDATE quests SET ReqQst='$questToSet' WHERE QID='$id'"; print($query); $queryVV = "UPDATE quests SET FolQst='$id' WHERE QID='$questToSet'"; print($queryVV); } elseif ($_POST['Submit'] == 'Set followup') { $query = "UPDATE quests SET FolQst='$questToSet' WHERE QID=$id"; print($query); $queryVV = "UPDATE quests SET ReqQst='$id' WHERE QID='$questToSet'"; print($queryVV); } else { unset($query); unset($queryVV); } Connect(); // Do update if (mysql_query($query)) { if (mysql_query($queryVV)) { $updateGoTo = 'RecSeries.php?qst=' . $questID; header("Location: $updateGoTo"); } else {echo '<h1>ERROR updating vica versa quest!</h1>'; exit;} } else {echo '<h1>ERROR updating quest!</h1>' . var_dump($_POST); exit;} } // ========== END update record ========== Here is one of the lists to select: the values appears fine, but it's like no post values are submitted. I have put a print_r($_Post) on top file and when this submit button is pushed, the post array is empty, but the method="post", so i'm clueless as to why nothing gets posted. $questsInZone = GetQuestsInZone($zone); //$questsInZone = array("null" => "<none>") + $questsInZone; // 3A - REQUIRED // if ($setValue == 'req') { ?> <form id="form" name="form" method="post" action="RecSeries.php?qst=<?php echo $questID; ?>"> <p><span id="spryselect5"> <label for="questToSet">Required quest:</label> <select name="questToSet" id="questToSet2"><?php foreach ($questsInZone as $reqQuestID => $reqQuestName) { $reqQuest = GetQuestInfo($reqQuestID); if (empty($reqQuest['FolQst']) && $reqQuest['Faction'] == $quest['Faction'] && $reqQuestID != $questID) { ?> <option value="<?php echo $reqQuestID; ?>"><?php echo $reqQuestName; ?></option><?php } } ?> </select> <span class="selectRequiredMsg">Please select an item.</span></span></p> <p><input type="submit" name="Submit" id="Submit" value="Set required" /> </p> </form> I think the problem is nothing gets posted when I click the Set required button. Any help appreciated!
  7. [sOLVED] // get key if ($key = array_search($questID, $obtained)) { $found = true; } elseif ($obtained[0] == $questID) { $key = 0; $found = true; } else { $found = false; } //remove if found if ($found) { unset($obtained[$key]);
  8. Hey, I've used Excel's standard deviation and confidence functions, and I'm looking for something similar in php. I used the standard deviation for the confidence, giving me a conservative and aggressive 'boundry' from the average. I couldn't find it http://www.w3schools.com/php/php_ref_math.asp What I'm looking for is to get a calculated minimum/conservative value and maximum/aggresive value for an array's values. Does anybody have functions or something that I can use?
  9. Thanks rhodesa!! that explains it! OK, but it is not to say the result will be the first key, it could stretch into thousands in the end. So my code was all wrong, coz it has that error if it's the first record and returns 0 which equates to false. Is this better? Also, can I now take out the reset($array); ?
  10. I have problems figuring this out. I expect it to remove the number and set the cookie again, but it gives this error: Quest 132 not found in obtained: Error in search! array(1) { [ 0 ] => string(3) "132" } Here's the code: // remove qst, implode, and set reset($obtained); if ($key = array_search($questID, $obtained)) { unset($obtained[$key]); $adjObtained = implode(" ", $obtained); if (setcookie("obtained$s", $adjObtained, time()+86400*30)) { $goto = "setquests.php?sel=" . $s . "&drop=" . $questID; header("Location: $goto"); } else { echo '<h1>Cookie could not be set!</h1>'; ?><pre><?php var_dump($adjCompleted); ?></pre><?php exit; } } else { echo "<h1>Quest $questID not found in obtained:</h1>"; ?><pre><?php var_dump($obtained); ?></pre><?php exit; } Can anyone please help? It seems as soon as the array is only 1 size big, it can't find the value...or maybe it can't find the first value... sigh, please help
  11. OK, finally google helped me with the global question: So I've changed the both $rsAll to global: mysql_select_db($database_connWoW, $connWoW); $query_rsAll = "SELECT * FROM quests WHERE Faction = 'Horde'"; global $rsAll; $rsAll = mysql_query($query_rsAll, $connWoW) or die(mysql_error()); $row_rsAll = mysql_fetch_assoc($rsAll); $totalRows_rsAll = mysql_num_rows($rsAll); function GetCloseQuests ($low, $high, $level) { global $rsAll; mysql_data_seek($rsAll, 0); $row_rsAll = mysql_fetch_assoc($rsAll); However, the error is still the same: WTF does 7 mean? Please help me!
  12. Hey, I have a file that only has php functions in it. I've also included a recordset in that file. First question is if I am using the recordset result correctly, I made the result global in the function, is it right? Secondly, I get this error and I don't understand it. Can anyone help to resolve this? code from file: mysql_select_db($database_connWoW, $connWoW); $query_rsAll = "SELECT * FROM quests"; $rsAll = mysql_query($query_rsAll, $connWoW) or die(mysql_error()); $row_rsAll = mysql_fetch_assoc($rsAll); $totalRows_rsAll = mysql_num_rows($rsAll); function GetCloseQuests ($low, $high, $level) { global $rsAll; mysql_data_seek($rsAll, 0); $row_rsAll = mysql_fetch_assoc($rsAll); etc
  13. Hey! I used the insert record which is provided by Dreamweaver. And i have a page insertcomplete.php where it redirects to after it was inserted. However, now i need to also carry over 2 variables via GET. Here's the default code: $insertGoTo = "insertcomplete.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); I have to add the $kingdom and $zone variables to that, e.g. "insertcomplete.php?kingdom=$kingdom&zone=$zone" , but ofcourse that doesn't work. any help appreciated!!
  14. [solved] this works: if (isset($_COOKIE['totalCount'])) { $CookInc = $_COOKIE['totalCount'] + 1; } else { $CookInc = 1; } setcookie('totalCount', $CookInc, time()+86400); I think $_COOKIE['totalCount']++ doesn't work...anyone knows why??
  15. Thanks! It's still not working though, but I've tried the following so it must be wrong somewhere? if (isset($_COOKIE['totalCount'])) { $cookInc = $_COOKIE['totalCount']++; setcookie('totalCount', $cookInc, time()+60000); } else { setcookie('totalCount', 1, time()+60000); } I think the cookie doesn't save or something It keeps being at 1. Am I setting it correctly?
×
×
  • 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.