Jump to content

garry

Members
  • Posts

    217
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

garry's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Thanks for the note uniflare, all my dates will be recent but that's good to know
  2. Worked great, strtotime converted the dates to unix very easily. Thanks both of you
  3. Sorry, not my format, it's from an XML feed So changing it to a unix timestamp shouldn't be too hard. Once I've done this, which loop would do it? (I had a look at arary_multisort and couldn't see an argument for a key to sort by?)
  4. So i have an array with a bunch of arrays inside of it. Of the second arrays, each has a "date" key with a date and time formatted as "24 Oct 2008 05:00:00 AM". What I want to do is to sort this array by date and time, ascending. I've had a look at the array sorting functions on the php.net website and haven't come up with anything i think can do it.. do you guys know any way?
  5. When I try to put a date of that format into the date() function, it returns Thu, 01 Jan 1970 10:00:22. So i'm going to have a wild guess that it's an incorrect format?
  6. So I have a string containing a date and time in the following format 22 Oct 2008 12:45:00 PM Basically, I need some sort of regex to split up the date and the time into two different variables.. I've tried playing around with some but I haven't quite got it, i'm not so great at expressions. Any help would be greatly appreciated.
  7. So I'm using Wordpress and need help rewriting one of the URL's. This is being done with a plugin and is outside of the capabilities of the WP admin panel. I'm thinking I'll need to use .htaccess to do this? This is an example of the URL mysite.com/something/?name=something/ This is how the URL's look now. What I want to do is rewrite it so that it just says mysite.com/something/something, where "something" is sent as the $_GET value. What's the easiest way to do this? Thanks in advance.
  8. woot, that was pretty much perfect, just had to remove the blog_posts table from the FROM clause and it works perfectly (SELECT COUNT(id) FROM blog_comments WHERE blog_comments.post_id = blog_posts.id) AS num_coms
  9. You can also use the database for sessions too, if you don't like storing certain information in cookies. The latest CI install lets you store userdata in the database, making it more secure
  10. Ah, I spoke too soon! This sort of does what I want, but how do I tell it to return the number of comments for each individual row returned? At the moment, I can only tell it to return the total amount of comments. Is there a mysql command that lets you do it for a particular row? Here's an example of my query: SELECT `blog_posts`.`id`, `blog_posts`.`user_id`, `blog_posts`.`title`, `blog_posts`.`body`, `blog_posts`.`created`, `blog_posts`.`modified`, `users`.`username` AS author, (SELECT COUNT(*) FROM blog_comments WHERE ?what do i put here?) AS num_coms FROM (`blog_posts`) LEFT JOIN `users` ON `users`.`id` = `blog_posts`.`user_id` ORDER BY `created` DESC LIMIT 10
  11. Come on, nobody? Surely someone has an idea?
  12. So I'm making a pretty simple blog using the codeigniter framework. Basically, in my query to get the latest 10 posts for the front page, I wanted to include the number of comments each post has. My tables are as follows: blog_posts blog_comments blog_comments has a field called "post_id" with the id of the corresponding post. Is there a way I can include the number of comments each post has? I'd love to get it all in one query to help with load times and such. Here's the current query I'm using to get all the post info.. SELECT blog_posts.id, blog_posts.user_id, blog_posts.title, blog_posts.body, blog_posts.created, blog_posts.modified, users.username AS author FROM (blog_posts) LEFT JOIN users ON users.id = blog_posts.user_id ORDER BY created DESC LIMIT 10
  13. Hi, this is a very simple question but I haven't had much luck so far. Basically, what I want to do is catch all pages request for mysite.com/somepage.php and have them show as mysite.com/somepage. I know this is possible with the mod_rewrite and I have a htaccess file created but I can't find a rewriterule to use on it. I think I also need to exclude certain directories, such as /img and /js. Can anyone help? Thanks!
×
×
  • 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.