Jump to content

GlassCasket

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

GlassCasket's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Anyone please? I've asked this many places but no one seems to know. And if I'm not being clear enough, just ask. Thanks!
  2. I read http://www.sitepoint.com/article/hierarchical-data-database and had a few questions. I posted on their forums no one seems to be able to help. Great article, read it several times. I have the following structure: HTML Code: - TB - cat a - cat b - sub-cat b - sub-cat b - sub-cat b - cat c My table structure is 'category_id, name, lft, rgt'. The category_id is linked in with my products table. Any ideas how I can display my products in the following fashion: HTML Code: - TB - cat a - product from sub category a - cat b - sub-cat bb - product from sub category b - sub-cat bbb - product from sub category bbb - product from sub category bbb - sub-cat bbbb - cat c - product from sub category c Thanks!
  3. Alright, thanks for the reply. But would you mind explaining a bit what is going on in your class? I don't really know what goes in $name, the item name? And what you're telling me is that I shouldn't store each item into an object, right?
  4. So I'm about to build a quoting tool which will use MySQL as a database. The quote builder will fetch and display 250+ items. Also, I will need to access the items image & long description along with a few small tid bits. So I was wondering, should I store each item into an object and do a call like '$item_one->get_desc();"? Is that too maybe objects floating around? I was thinking this would be a good idea so you wouldn't query the database multiple times as all the pertinent information would be stored into the object. Also, would storing each object into an array be advisable? Thanks!
  5. I'm new to OOP PHP5 and I'm trying to use the singleton pattern for my Database class. Here is my current code (yes, the getInstance is from the PHP manual): <?php final class Database { private static instance = null; private $username, $password, $host; /* * Prevent an object from being constructed */ private __construct() { } private __destruct() { } /* * Return the instance of this class */ public static function getInstance() { if(is_null(self::$instance)) { self::$instance = new Database(); } return self::$instance; } protected function connect($username = "test", $password = "test", $host = "test") { } protected function query($query) { } } ?> My questions are: - How can I restrict this to only one connection which every thing in the file can use? - How can I make the quiery() function? I'm not quite sure what to return. This is only suppose to be a basic database class which will allow me to connect and run queries. If anyone has any suggestions and ideas, don't hesitate to write them out. Thanks!
  6. You're right. This project could become big and I just wanted to keep things as organized as possible. if's it is!
  7. I'm starting a new project soon and had a few design questions. The project will entail having a basic first page where the customer will input basic information about themselves. Then will proceed to an order form. So I'm assuming that you shouldn't be able to see the order form if you haven't gone through the main page. So I guess my question is: What is the better design to check certain conditions on page load up? I'm not sure if using classes is appropriate or simply using if statements. Thanks!
×
×
  • 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.