Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. Also rounds to 13. The number_format() function performs a round if necessary.
  2. Newish version of php? glob() Rubbish older version? opendir() and readdir().
  3. Assuming you always want to round down the fraction of the penny then multiply by 100, round down, divide by 100: $var = 12.995; $var = floor($var*100)/100; echo $var; zenag, that will round to 13. A half rounds up.
  4. You might want to take a look through this article on the MySQL website: http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
  5. Well, it is possible like so: $Value1 = "hello"; $Value2 = "world"; $Value3 = "HI"; ${$Value1.$Value2} = $Value3; echo $helloworld; However, i agree with ProjectFear that there might be a better solution in the long run if you explain your problem some more.
  6. You've not actually shown us what line is causing the error. As you can see from the message, the error actually occurs in your functions.inc.php file. We'll need to see the relevant part of that. In future, when posting code, can you use the tags please.
  7. Yeah, but then they all have their own lives to deal with too.
  8. Personally i'd be looking to read the contents into a string and strip out the xml declarations before echoing the rest of the content.
  9. Well that is at least part of your problem then. That declaration should only appear once. You should only be setting the content type once too.
  10. No, my declaration i mean <?xml version=... And I think you misunderstand me. What I was asking to see is the output (and specifically the source) of the above script.
  11. Given that you're loading two sets of XML data, it's entirely possible that there's two XML declarations, which is bound to give you problems. Try pasting the source of the generated file.
  12. It's more than likely that a better solution would to have mutliple stylesheets and have PHP determine which stylesheet to load.
  13. Well, not exactly. You could rename your css file with a PHP extension and have it echo out the css. However, you would then lose the benefit of allowing the browser to cache the css file which reduces bandwidth usage and load times. The real question is why would you want to?
  14. You dont - you just check to make sure it's greater than or equal to one or, indeed, check to make sure it isn't 0. Afterall, we know we wont get a negative return value.
  15. What you don't do is think of storing the multiple values in one field. If you do, you'll run into all sorts of problems. The correct approach is to use a separate table. For example, you might have the following items table: itemid, description, price You would then have a separate colours table: itemid, colour There would then be a record in the colours table for each individual colour for each item. As for the searching of multiple tables, ill direct you to an excellent tutorial on this: http://www.phpfreaks.com/tutorial/data-joins-unions. The tutorial will also help you to understand why you need multiple tables. For further reading, google database normalization.
  16. It really depends on the scope of the problems you're trying to solve. Obviously the advantage of a computer is that it is often acceptable to repeat the calculation many times, negating the need to find a way of simplifying the expression. On the other hand, it shouldn't be too hard to come up with something to simplify an expression given a relatively small size of potential expressions to solve.
  17. Read the entire file into a string, update the particular value in that string, write the whole string back to the blank file.
  18. But there's a pretty big difference between 1,500 users and 1,500 concurrent users.
  19. Try this: $month = 8; $year = 2008; $start_of_month = mktime(0,0,0,$month,1,$year); if(date('N',$start_of_month)==2){//first day of month is tuesday $second_tuesday = date('d-m-Y',$start_of_month+60*60*24*7); }else{ $second_tuesday = date('d-m-Y',strtotime('next tuesday',$start_of_month)+60*60*24*7); } echo $second_tuesday;
  20. Are you really going to have 10,000 users online at any one time? I wouldn't worry.
  21. I'd recommend starting with the examples given in the manual: http://uk.php.net/features.file-upload
  22. Set a counter and increment it in your loop: $i = 1; while($member = $query->fetchrow()) { echo "<tr>\n"; echo "<td><a href=\"profile.php?id=" . $member['username'] . "\">"; echo ($member['username'] == $player->username)?"<b>":""; echo $i.'. '.$member['username']; echo ($member['username'] == $player->username)?"</b>":""; echo "<td>" . $member['money'] . "</td>\n"; echo "<td>" . $member['level'] . "</td>\n"; echo "</tr>\n"; $i++; }
×
×
  • 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.