Jump to content

Adam

Moderators
  • Posts

    5,717
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Adam

  1. Look into the MySQL "LIMIT" clause. E.g. select * from your_table limit 0, 5 That selects only the first 5 rows matched. In order to return the last five, you will need to "ORDER BY" a chronological field; either an auto incrementing number, or a date field. E.g. select * from your_table order by entry_id limit 0, 5 select * from your_table order by entry_date limit 0, 5
  2. You attached over 4,000 lines of code in a MS Word document? Seriously, in future I'd make it easier for people to help you by posting only the relevant lines of code. In answer to your problem, in the phpbb_optionget() function you have a syntax error: return($data & 1 <<(int)$bit) ? true : false; Not 100% sure what you were trying to do here though. Did you mean..? return(!empty($data) && 1 < (int)$bit) ? true : false;
  3. Sorry I've been AFC all week-end. What do you mean "broke out of PHP"?
  4. I see. So different products have a range of finishes available to them? In that case then I'd store the data like this: array( 'prod1' => array( 'fin1', 'fin1', 'fin2', ), 'prod2' => array( 'fin1', ), 'prod3' => array( null // remember you mentioning null values ), ); To get the quantity you can just count the values in the finish array for a particular product. To list the finishes for a particular order just format the finish array in a nice looking way.
  5. I don't think XML is the right way to go here. If you want to keep a history of the posts, use a database. If you just want to keep the current announcement stored, store the HTML within a text file and read that from the web page. If they update the text file by FTP that kind of defeats the point of it, as they'll be coming back to you asking you to format the HTML everyday. Provide a simple admin interface for them to login and create a new post. If you're storing it in a file, purge it and write the content they entered in the WYSIWYG. Obviously if it's a database insert the new record and just display the latest post on the site.
  6. Incidentally.. <?php // <= PHP 5 $file = file_get_contents('./people.txt', true); // > PHP 5 $file = file_get_contents('./people.txt', FILE_USE_INCLUDE_PATH); ?> Do exactly the same thing. FILE_USE_INCLUDE_PATH == true.
  7. Fair point, I just remembered "daily announcements". Guess it depends if flemingmike wants to keep a history.
  8. "For such a small thing" .. What happens if they end up with a few hundred postings? It's also harder to remove and update previous posts.
  9. Install a WYSIWYG editor too so you don't have to format them anything.
  10. Not sure a title for every post is needed, but I think it's a good suggestion being able to update the thread title. On the other hand though, half the time people post titles like "N00B IN NEED!!!" or something, I can't see them (or probably the greatest part of the user base) going to the effort of updating the title. Question of whether the reward would actually justify the investment.
  11. Ahhh, sorry you didn't explain it very clearly. I thought you were referring to an ID parameter. That's easy then: $wsMenu = Array ( 'start' => array( 'href' => '?p=start', 'id' => 'id1' ), 'karta' => array( 'href' => '?p=karta', 'id' => 'id2' ), 'bilder' => array( 'href' => '?p=bilder', 'id' => 'id3' ), ); foreach($this->iMenu as $text => $link) { $menu .= '<a href="'.$link['href'].'" class="menu"'; if (!empty($link['id'])) { $menu .= ' id="'.$link['id'].'"'; } $menu .= '>'.$text.'</a> | '; }
  12. Not necessarily as a separate product, otherwise you'd have to up-keep two products if any shared detail of it changed. If you've heard the term SKU before it partly relates to having a separate order-able SKU for variations in the same product. You have a main product ID that holds the product's details and then a SKU ID which holds the variation. If there's only 1 version of a product, there'd only be 1 SKU for it. You assign the varied attribute(s) to the SKUs, and then place the order based on the SKU as opposed to product ID. The queries would need to join up the required data to give you the product details. It's obviously a much more complicated architecture. It's up to you if you want to get down that route, you could just write a bit of a hacky work-around. It's for problems like the one you're having though that these designs are used. Edit: Just to add that may be a little over kill for your situation thinking about it.
  13. I can't even focus on the design with all those adverts there. Do you really need that many? If you piss people off enough with them they won't click them, they'll leave.
  14. .. What's the error? Wait a minute. Thinking about it, and maybe I'm missing something, but can't you just store the URL with the parameters..? $wsMenu = Array ( 'start' => '?id=start&foo=bar', 'karta' => '?p=karta', 'bilder' => '?p=bilder', ); I'm also a little unsure about what "." is meant to mean?
  15. How do you store the variations in finishes within your DB?
  16. Will it always be a fixed loop of 1-6? Seems a bit of an odd siltation.
  17. Through some form of input (e.g. XML (or SOAP), JSON, URL parameters, etc.) you need have some form of "language" if you like that defines what it is they need. Without knowing anything about the queries or data the user would need though, I can't really give any suggestions.
  18. I don't think it should by WHO, but for what purpose. What will the file contain? My bad. I misunderstood the following to mean it doesn't matter what format the user provides.
  19. Perhaps rather than giving them full (or restricted) access to the database, you should pipe the requests through an API. That way you'll have much more control over the queries they try.
  20. What if they give them their PIN too?
  21. This isn't easy to do to support any format (or many different ones). PDF, RTF, DOC, etc. are all formatted, they aren't in plain text. PHP has a vairety of classes, libraries and extensions available on the net that you may be able to use, but each is likely to only support 1 format.
  22. You could limit incoming connections to specific addresses? Then allow each custom to access an admin area on your website and set their address. That won't prevent them giving it somebody else (if you're giving them something, you have absolutely no way of physically stopping them doing that) but it will make the product unusable. At least it will if I'm following you right.
  23. I'll take your word for it. Try this: $wsMenu = Array ( 'start' => array( 'id=start_link', 'foo=bar', ), 'karta' => '?p=karta', 'bilder' => '?p=bilder', ); foreach($this->iMenu as $text => $href) { if (is_array($href)) { $href = '?' . implode('&', $href); } $menu .= "<a href='{$href}' class='menu'>{$text}</a> | "; } The only problem is it's limited to pages with multiple params starting with "?". You may want to extend it further to allow a prefix link for the params.
  24. I have no insight into your system so I can't say as to how risky that would be. Consider you have a PHP file filled with functions. The file is independent to the main application flow and is only required for certain functionality. At one point you include the file, but then much later in the application you include it again. Since the file has already been included and you're effectively trying to re-declare the functions, you'll get a fatal error. In certain situations though that event may be rare and unnoticed during any testing, and may go on being unnoticed until someone reports it. Times like that are when include/require_once is really useful, but it's really down to your own initiative to decide whether '_once' is required or not; you know your application better than anyone else. Just don't worry so much about using include/require_once for 'expense' reasons.
  25. $this->iMenu .. was that meant to be $wsMenu? I don't understand what you mean by "'id' + names". Could you provide an example of some form to better illustrate?
×
×
  • 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.