Jump to content

mkoga

Members
  • Posts

    51
  • Joined

  • Last visited

    Never

Everything posted by mkoga

  1. Although I prefer to format on Mysql side of things. Here is a clean PHP solution: <?php echo date('d-m-Y', strtotime('2008-03-14')); //prints out 14-03-2008 ?>
  2. One way to handle such a complex search is to index them with lucene. The zend framework has an implementation of it: http://framework.zend.com/manual/en/zend.search.lucene.html along with tutorials.
  3. On osx the terminal should have ssh by default. I'm currently using Aptana, similar ftp features as dreamweaver. The only thing is that Aptana is based on eclipse which can be a RAM beast. If someone could offer a better alternative with similar features that would be awesome.
  4. Why not store page content in the db? Or skipping the db and map url data to files. Try taking a look at some other cms to see what they are doing. I've looked at drupal before, it gave a lot of insight.
  5. If you are going to use the data in the controller before passing it to the model, then by all means, validate it. I like to keep validation in the model so if more than one controller uses the same model, you only need to write validation code once. Also depending on the framework you use, if any, you should probably screen input before the data hits the controller. Just to cover Sql Injection and XSS. Hope that helps.
  6. I'm planning on sending some emails 10 seconds apart from each other until an email queue is complete. Does anyone have an opinion on which would be better for performance? I could sleep(10) after each email sent or run a cron job every 10 seconds. I would rather use a cron job, but I would have to keep the cron job running every 10 seconds 24/7 unless I did an exec('crontab') call. I guess what it basically comes down to is which is better: running one really long php instance or running a bunch of really short php instances? Any thoughts?
  7. print $_SESSION['userid'] to see what value you're sending to the database.
  8. awesome! never knew about the toPrecision() method. thanks.
  9. make sure that $data contains a correct path to the image. try printing it out to the screen just to check.
  10. more like: document.getElementById('tot').innerHTML = pad(vT);
  11. You can run vT through this function and use the return value as the innerHTML.
  12. try something like this: function pad(num) { var result = num; if (result.indexOf('.') != -1) { var tmp[] = num.split('.'); var suffix = tmp[1]; if (suffix.length < 1) { suffix = "00"; } else if (suffix.length == 1) { suffix += "0"; } else if (suffix.length > 2) { suffix = suffix.substring(0, 2); } result = tmp[0] + "." + suffix; } else { result += ".00"; } return result; }
  13. I believe you have to specify the scope with the global keyword. <?php $myVar = array(); function doSomething() { global $myVar; $myVar[] = 'do something'; } ?>
  14. OR is correct. cooldude832's suggestion returned nothing?
  15. oops, read the $_SESSION['LOGGEDIN'] == FALSE a little too fast.
  16. A possible solution would be to use Headers to send binary data from the database.
  17. Also cleaner indentation would help recognize blocks a little easier.
  18. It is possible that the problem is that your positions are relative, try changing to absolute and see if that helps.
  19. If you destory the session with session_destroy(), can you still store in the global variable $_SESSION?
  20. shouldn't it be: <?php $takenick = mysql_query("SELECT Nickname FROM Froobs WHERE Nickname = '{$_POST['nick']}'"); $takemail = mysql_query("SELECT Email_Address FROM Froobs WHERE Email_Address = '{$_POST['email']}'"); if (mysql_num_rows($takenick)) {$error = "1";} if (mysql_num_rows($takemail)) {$error = "2";} if ($error != "1" && $error != "2") { /*Execute database input*/ } ?>
  21. It might be a good idea to use firebug on firefox to profile your site. That way you can see exactly what is taking the longest to load. Firebug: https://addons.mozilla.org/en-US/firefox/addon/1843
  22. you'd have to use javascript: function gotoUrl(url) { document.location = url; } function startTimer() { setTimeout("gotoUrl('<?php echo $url; ?>')", 5000); } then just call startTimer to start the 5 sec count down. hope this helps.
  23. It's tough to say without seeing the page in it's entirety. I would suggest placing an alert('here') in the swapImages function just to see if the code is even reaching the function.
  24. I saw this on ajaxian. It could be interesting to try. It's called phpQuery which is a php port of jQuery. It looks like you should be able to select elements by css selectors and return them as a php object. Here's the link to the project: http://wiadomosc.info/plainTemplate/ If anyone tries this out, let me know what you think.
  25. You could try: $str = 'text goes here'; $encoded = base64_encode($str); $decoded = base64_decode($encoded);
×
×
  • 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.