Jump to content

jggretton

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jggretton's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. So far, from what I can tell if it's a standard .css file it comes through fine, if it's a php driven one it occasionally goes wrong. I've actually founds another quirk which is that it seem to make a difference what html file (well, php file) I load the css document through. I'm not at my work station anymore, but I'll look into this further tomorrow, but it might be something to do with if the html file is still loading when it loads in the css... Not sure if that's right, but it's an idea. Thanks for your help, James
  2. Hi Ken, I hadn't posted code previously as there was a lot of framework stuff going on too, but after some experimentation I've managed to get the problem to occur with nothing but this code: /css.php <? header("Content-Type: text/css"); print "test"; ?> /.htaccess AddOutputFilterByType DEFLATE text/html text/plain application/json A few other points: So far, I've only noticed it in Google Chrome on the PC (XP & Windows 7) but this might be because the other browsers are more forgiving of fluff at the top of a css file It doesn't occur when accessing a file directly, only when it's loaded in by my HTML (so perhaps related to Connection: keep-alive?) When it does occur, the file comes down with no response headers. Chrome is then treating it as a application/octet-stream
  3. Well, I still don't know what's actually going wrong, but I've narrowed down the problem to DEFLATE compression in my .htaccess file. The problem is being caused by the following .htaccess rule: AddOutputFilterByType DEFLATE text/html If I remove this line then all works fine. Gzip isn't really essential for this site so I'm happy to leave it this way. Hopefully this will help anyone else with the same problem. If anyone does know what's really causing the problems here please do reply anyway - I'd be very interested to know. Many thanks, James
  4. Hmmm, has no-one experienced anything like this before then? I'm really stuck so would appreciate any ideas, however vague they might be! Many thanks
  5. Good call Ken, so gojo could fix this by adding the following line: $_FILES['image']['type'] = image_type_to_mime_type(exif_imagetype($saveto)); Just after the move_uploaded_file statement. So it would read: move_uploaded_file($_FILES['image']['tmp_name'], $saveto); $_FILES['image']['type'] = image_type_to_mime_type(exif_imagetype($saveto)); Hopefully that should do the trick!
  6. Most people do this using .htaccess and mod_rewrite. You can find some basic information on .htaccess files here, and more information on mod_rewrite here (see 'beautiful urls' section).
  7. The code below would do the trick: $string = "testing123"; $output = preg_replace('/./', '*', $string); print $output;
  8. If it's acting differently in IE and Chrome it's likely to be a problem with how the browser is displaying the images. Could you open the converted image directly in each browser and press refresh (ie go to http://www.yoursite.com/image-folder/converted-image.png) and confirm that they are really different?
  9. Hi all, I've got a frustrating problem on a site where PHP is outputting content *before* the headers, causing the headers to show up as plain text. This is only happening on a .css file which is powered by PHP (at least I'm only noticing it on a .css file) and is only happening occasionally, usually the second time I visit the site in a session, and not again for a while. Pressing refresh fixes it. I've listed some of the output below, lots of unknown chars, followed by the headers and then finally the actual stylesheet. Not that the first part may not have copy and pasted 100% accurately. If anyone has any ideas I'd be very grateful. Thanks, James ��#��P��(vԄ��l�?ml��ʇD�n.��r�����N d�F1eO�L4�� (Cc0��4�%s��h/�W�����zZ�y��%�`�����M“�c^^�I3s�8���#����]A���R��Hȗ��`G{� HTTP/1.1 200 OK Date: Mon, 28 Mar 2011 08:24:46 GMT Server: Apache/2.2.17 (Unix) FrontPage/5.0.2.2635 X-Powered-By: PHP/5.2.17 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Keep-Alive: timeout=5, max=99 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/css 24d8 @charset "utf-8"; /*---Stylesheet---*/ html, body{ ..........
  10. Thanks Mikosiko, they look very interesting - it's amazing how similar the first part of the dev.mysql.com article is to my question! The second article is a little over my head at the moment but I might spend a few hours learning about MySQL functions and then perhaps I will be able to use it in my project. Many thanks for your help, James
  11. Hi all, this may have been asked many a time but I haven't had any luck finding it. If you know of a past post that's similar please do point me to it. My problem is as follows: I've got a table of categories, with an `itemID`, a `parentID` and a `title`. The first level has a parentID of 0. Categories are then nested eg. the children of an item with itemID=1 have a parentID of 1. A categories can have multiple children, each child can have children etc etc. I'd like to achieve a MySQL statement which given the itemID of the bottom most child, will return all the items in the parent category, all the items in the parent's parent category, .... , until we reach the base. This may be unachievable so a more simple initial aim might be to get a statement which given the itemID of the bottom most child will return the parent item, the parent item's parent item, ... , until we reach the base. Below is an example table: CREATE TABLE `cats` ( `itemID` int(11) NOT NULL auto_increment, `parentID` int(11) default NULL, `title` varchar(128) collate utf8_unicode_ci default NULL, PRIMARY KEY (`itemID`)) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;insert into `cats`(`itemID`,`parentID`,`title`) values (1,0,'Foods'),(2,0,'Drinks'),(3,1,'Sweets'),(4,1,'Savory'),(5,3,'Biscuits'),(6,3,'Cakes'),(7,6,'Jaffa'),(8,6,'Sponge'),(9,5,'Hobnob'),(10,5,'Custard cream'),(11,5,'Abbey crunch'); So far I've can pull out the parent categories with a table for each: SELECT a.*FROM `cats` AS `a`, `cats` AS `b`, `cats` AS `c` WHERE c.itemID = 11 AND ( a.itemID = c.itemID OR a.itemID = c.parentID OR (a.itemID = b.parentID AND b.itemID = c.parentID) )GROUP BY a.itemID; But this wont work for n depths And I can also pull out pretty much everything by matching a.itemID = b.parentID SELECT a.*FROM `cats` AS `a`, `cats` AS `b`WHERE a.itemID = b.parentID OR b.itemID = a.parentIDGROUP BY a.itemID But this just gets me a mess of everything rather than the items I need. Does anyone have any suggestions for how I might go about this and also about the efficiency of the query? Thanks for any help you can provide. James
  12. Ah, thanks Mchl. That's certainly the stage I've now got to - make it UTF-8 and stop worrying about it! You have pointed out one bit which I previously missed (which is very important): Point 5. PHP - MySQL connection. I will have a play with this now. Thanks for your help, James
  13. Hello, in case anyone else comes across this question themselves, I did find a very useful article here: http://www.sitepoint.com/article/guide-web-character-encoding/ Backed up by a forum post here: http://www.sitepoint.com/forums/showthread.php?t=450442&page=1 (ignore the comments by the ranting bloke though) Any other good articles would be appreciated! Thanks, James
  14. Well if it's (b) you'll need to make some changes to the PHP code that submits the property to the database. When I submit data from checkboxes to a db, I usually clear all the db fields that store the checkbox first and then resubmit everything. How and what you'll need to clear will depend on your PHP code so I can't help you right off I'm afraid. You could try submitting the code to the forum, but if you're not experienced in PHP you will need to be very careful not to submit any sensitive data such as passwords within the code... You might be better off getting a professional to have a look?
  15. Hello Graham, is the problem that: a) checkboxes that are not visible on the page are still submitting data to the db or b) unselecting checkboxes does not unselect them in the db ? Just to warn you: either way, I think you'll probably end up having to edit the php...
×
×
  • 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.