Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. Can you add this line and copy and paste the output (for a url which fails validation): print "<p>The url I am testing is " . htmlspecialchars($url) . "</p>";
  2. I don't see any call to run the query. I would expect to see something like dbExec($sql);
  3. Indenting your code would make it more readable. There are many styles of indentation, for example: while ($foo) { print "foo\n"; } while ($foo) { print "foo\n"; } Otherwise it is very difficult to see where an "if" or "for" starts and ends.
  4. Is that your entire script? And does the error happen with every image, or only one image?
  5. CPU isn't always more costly than memory. It depends on which you need more at the time I started on an implementation of C struct style arrays for php (using the C interface).. the idea is that you specify the structure of your array using C data types, and then pass data in from php for efficient storage. It was never finished, but the idea is good. The cost is that access will be slower than accessing php's native data types, but if you have a lot of data, you may be willing to trade time for more space. The data would be packed as C packs it, with no gaps except for those required by alignment restrictions. You could compress a lot of types of data down to 10% or less of the php size by packing it like that.
  6. Hmm.. would it make sense for the players to select an action, and have your script change the views based on the action? I'm not really sure what you mean by "view" here.
  7. You might be interested in my post here: http://btherl.livejournal.com/12875.html It's around 56 bytes to create a new array entry. More space will be used when the array is expanded (array size is doubled each time space runs out). And storing long strings will take more space of course (one byte per string character). So 500 array entries * 56 bytes = 28 kilobytes, plus a bit more for overhead. You can always generate the array on demand when the first call is made, and cache it each time (if I understand your situation correctly)
  8. "?" is a preg metacharacter.. try this if(!preg_match("~http://www.youtube.com/watch\?v=\w+~", $url)){
  9. I don't understand at all. Can you include some more detail?
  10. It's probably not valid XML. Have you looked at the page source?
  11. Ok, if that is your whole script, then you have a missing mysql query in the first script. You cannot fetch from a mysql result until you have done a query. You have another problem in that there is no mysql_connect() or mysql_select_db(). You cannot do mysql queries without connecting to a database. It may not be relevant, but variables from one run of the script (eg, before the form was submitted) are NOT preserved after the form is submitted.
  12. Which user-defined error message does it show? Which test is succeeding/failing when it should not be?
  13. Here's an idea .. install the "live http headers" firefox extension (google will find it for you) and see what it finds in the headers. It may even be setting them to iso-8859-1. You might be able to work around the problem by sending your own headers from php to override them, like header('Content-type: text/html; charset=UTF-8'); The other thing is to check any meta http-equiv tags that set charset.
  14. I would guess that firefox strictly interprets your web server's declared character set, but IE recognizes the BOM and handles it. My gut feeling is that your webserver is set to add the UTF8 BOM to each page, but it declares the content-type as utf8 without BOM in the headers. I'm not sure of the details of fixing that. It's also possible PHP is adding it.. has your php installation been customized for anything to do with character sets?
  15. Try this: SELECT mak.id,mak.name,mak.rating,mak.votes,mak.user,COUNT(comments.comment) AS num_comments FROM mak LEFT JOIN comments ON mak.id=comments.about WHERE comments.comment NOT LIKE '<i>%</i>%' GROUP BY mak.id ORDER BY num_comments DESC LIMIT 0,10
  16. Try this inside your loop (or outside.. the more places the better) print $itemg . " = " $$itemg . "\n"; Does everything look like it should?
  17. By that do you mean a blank page?
  18. Looks like a UTF8 byte order marker. What web server, OS (eg windows, linux) and which version of php are you using? And what browser are you browsing with? See here for details: http://msdn2.microsoft.com/en-us/library/ms776429.aspx
  19. What error does it come up with, and on what input?
  20. Is what you posted the full code for those pages? In any case, the solution is the same - print out your sql statements.
  21. Try printing out your sql statements. The problem may not be in the code you posted, so print out other sql statements as well. Especially print out ALL update and insert SQL statements, so you can verify that they are doing what you expect them to.
  22. What development environment are you using? windows? Unix? Which text editor?
  23. Often it's in /var/log or /var/log/apache. Your hosting provider is best placed to help you with that, as it can vary from system to system. You can also try looking in the apache configuration, usually found in /etc/apache, as the log location will usually be defined there.
  24. Can you post a copy of your output? Which part is printing "Resource id #5"? Typically that will occur if you try to use a mysql result directly rather than using mysql_fetch_assoc/mysql_fetch_array to extract the data first.
×
×
  • 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.