Jump to content

htzone

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by htzone

  1. I figured it out - there was a forgotten-about error_reporting(0) in one of my support files. This is what happens when you're coding on an empty stomach! Thanks for you help!
  2. So, I'm getting a blank PHP page and it's driving me nuts. Unfortunately the client won't let me post my code up here, but rest assured that I'm an experienced web developer and have checked all of the usual suspects. I enabled error reporting, checked my apache error log, and neither of those produce any messages. The syntax is correct. I tossed in "die('here!')" in a few places until I couldn't see it. I narrowed down the stop point as being somewhere in the middle of a foreach loop. Before this foreach loop, I'm using array_merge on some fairly large pieces of data, but nothing unreasonable. When I comment out the array_merge line, the page works correctly. I figured maybe there was some kind of memory issue, or execution timeout thing going on, but when I increase both of those settings it has no effect. In essence, I'm wondering what might be some causes of the blank page problem beyond the common ones, since I'm really scratching my head over this one.
  3. Sites like IMDB require a minimum amount of votes before their ratings are displayed, which is how they deal with this problem. You could just set the rating to only display once you hit five or ten votes.
  4. You could set up some <div> or <span> tags with id values in your template (so that they're unique), and then have your PHP script load the entire contents of that template, and then search through it and fill in the relevant <div> or <span> tags with the retrieved data. Then save all of this to a new file, as suggested earlier. No matter how you do this though, it's going to be messy.
  5. So, I'm using fsockopen/fgets to grab an xml file. The transfer encoding coming to me is chunked, so every so often there's a crap line in the middle of the file that I need to get rid of. Here's an example of the data: <SomeXML/>blarg</SomeXML> 0fe8 <SomeOtherXML>blah</SomeOtherXML> <MoreXML>zing</MoreXML> Here's the relevant code, for now: while (!feof($fp)) { if (strpos(fgets($fp), '<') === FALSE) { continue; } $response .= fgets($fp); } The strpos bit there does work - the HTTP headers don't show up when I use it - but the '0fe8' (and other similar values) still show. The weird thing is that the first occurrence of that value does get nixed (before the XML starts), but subsequent ones do not. Is this some new line/end of line thing? Could anyone shed some light on why this isn't working 100% of the time?
  6. I know what it is, but where is $id coming from? Dumb mistake about the parenthesis on my part.
  7. What is this line doing? mysql_real_escape_string($id)); It also has an extra ending parenthesis. Also, why does your function require variables that don't get used ($fname, $uname, $email, $phone)?
  8. Have you checked to see if mysql_error() throws anything back?
  9. I'm going to be writing a script that compares a column of values found in two different database tables on a daily basis. My question is this - is it more efficient to run my MySQL queries once and keep the data in a PHP array (and work with it in that form thereafter), or to query the database each time for every row in one of my tables? Basically, a single row in one table needs to be checked against every row in the other table (and this process needs to repeat for every row in the first table). Hope I'm making sense. I'm just not sure which way is going to be more efficient - advice? I suspect that putting the brunt of the work on the MySQL server is the way to go, but I'm not certain.
  10. You might find this useful: http://www.meandeviation.com/tutorials/learnphp/php-syntax-check/
  11. You can use this function to turn your XML input into an array: http://mysrc.blogspot.com/2007/02/php-xml-to-array-and-backwards.html Then cycle through the values with a foreach loop and do what you need to do with them. The output syntax used to access values in the array wasn't totally apparent to me at first - to save you some trouble, this is how you'd get at the email address in the first "contact" entry: $yourArrayName['messenger']['_c']['service']['_c']['contactlist']['_c']['contact']['0']['_v'] You need to change ['0'] to ['1'] to get the next entry, and so on. Hope that helps.
  12. I learned PHP from a book as well (PHP and MySQL for Dynamic Web Sites by Larry Ullman), but didn't fully comprehend a lot of it until I started to put concepts into actual code. It helps if you have a couple ideas for small scripts that you'd like to write. Don't try and do anything too crazy at first, keep your projects small to begin with, and you'll soon find that your knowledge is building upon itself. I would recommend that you invest in a PHP book, because you'll want to use it as a reference, and these type of books tend to explore the concepts behind common PHP techniques and functions and present the information in a way that's easier to understand than if you got it from PHP.net. PHP.net is an incredibly value resource however which I still use on a near-daily basis. For writing scripts I use Crimson Editor, which is free and offers syntax highlighting for PHP and many other programming, scripting, and markup languages.
  13. Someone may correct me on this, but if the total filesize of your attachments exceeds PHP's "upload_max_filesize" setting in php.ini, the latter attachment will be discarded (provided the first attachment doesn't exceed the upload limit as well). Sometimes you can increase this limit with an .htaccess file or by setting the variable in your script, and obviously in php.ini as well (if you have access to that). You can try adding this to your .htaccess if you have one: php_value upload_max_filesize 10485760 The value is in bytes, that particular setting puts the max filesize at 10 MB.
  14. You might want to try and track down some OCR (optical character recognition) code from somewhere for the image analysis. I doubt something like that will be able to give you detailed info about the characteristics of the font itself, but it would (in most cases) allow you to identify specific characters. I suspect you'll have to write code for recognizing font features yourself, or find some type of image comparison tool that you can adapt.
  15. The Perl CMS had a config file that allowed me to change the data directory, so I moved it out of /cgi-bin and got my script to work. Hardly an ideal solution, but the roadblock has been lifted...
  16. So, here's the typical first post asking for help. I promise to be back! If it helps any, my question is not coding-related. My script runs great locally, but when I put it on the production server to test it out, I found I wasn't able to read a text file stored in /cgi-bin (Apache server). This seems to be a security thing and I'm wondering if there's any way around this (I adjusted permissions to no avail). I'm trying to grab a bunch of data from the flatfile DB used by a Perl-based CMS for use as form options. I'm not sure what can be done here, but this has stonewalled the project. I believe the client is on a shared server so I doubt the hosting company will be cooperative with any requests to change their security policy. Suggestions?
×
×
  • 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.