Jump to content

garry

Members
  • Posts

    217
  • Joined

  • Last visited

    Never

Everything posted by garry

  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!
  14. Thanks for your reply. Was wondering if you could show me the basic gist of your registry class? And also, how it gets called on each page?
  15. I'm trying to put together a series of classes using OOP to make it easier to make the dynamic site I'm building. Basically, I have the following classes at the moment (more might be added later) Database Session User Validate I want to set it up so that all queries go through the database class (ie $db->query($sql). But I'm having trouble getting it all to work with each other (I'm new to OOP). To make all queries go through the database, should i create a new Database object for each query? Or is this bad practice? Also, I was wondering what the best way to handle the actual link to the database is. Because I was getting too many connections open errors. How can I only create the mysqli object with the connection once and then use it every time the database object is called? I'd really appreciate some help Thanks
  16. I have an image map menu and whenever a link is clicked, a dotted border appears around it, like in the image attached. Is there any way to stop this? Thanks for any help. [attachment deleted by admin]
  17. Thanks a bunch for the help. Just wondering though - does this technique work on all the major browsers okay? E.g IE 6 & 7, FF, Safari, etc.?
  18. I usually have no problem with menu's, but I've been given a task where the menu is diagonal and and has active states and such. I've attached a picture with an example. Can someone help me figure out how I can make the menu function with images (because it's not a standard font) and have it work properly when clicked and hovered when it is diagonal. I've never come across this and don't have a clue! Thanks for any help in advance. [attachment deleted by admin]
  19. When I use a background image for a background and have it fade into another color (which is a set background color and will extend down the rest of the page, however long it may be) Safari seems to have a different color. An example of this is attached. You can see that, instead of having a nice fade like it does in Firefox, it just changes color abruptly. I think this is something to do with color profiles, but I'm not sure. Can anyone help? Thanks! [attachment deleted by admin]
  20. Thanks for the help, i'll try that
  21. so basically, I have an unordered list with categories. Each unordered list has a black circular box background type thing going on and has a link inside it to the category. What I want to do is make that whole box (the <li> item) clickable, as opposed to just the link. Here's the css I'm using. div.block .block_content { padding:0.5em 0.7em 0pt; min-height:20px; } div.block li { padding: 6px 0 0.2em 0.8em; height: 24px; background: url('../img/catli_bg.gif') no-repeat; display: block; } And the html is just a basic unordered list. Can anyone help?
  22. Thanks guys for your help, this is exactly what I wanted
×
×
  • 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.