Ok, I don't know what to do about this one!

    function dbBills() {
       //this is the class instantiation function. In here you'll want to create an
       //instance of dbAccess and point $this->db at it.
    } //end dbTable

    Actualy,

    I don't know how to setup theses 2 also:

    function Search ($wc,$ob='ID',$start=0,$limit=0)
    function IDList($start=0,$limit=0)

    Or how to start them.

    Can you give me a litle crash course on this?

      okay set it right, you should be able to write get as it's like set but even easier.

      dbBills should point $this->db (or the db Attribute of the dbBills class) as a new instance of the dbAccess class that we created last week.

      for examples of this please refer to
      http://us2.php.net/manual/en/ref.classobj.php

      pay special attention to the first two examples and how they relate to one another.

      for Insert you are inserting a record into the database. The values should already be assigned to the class attributes. You want to use the SQL insert command on conjunction with mysql_query.

      For more information on this function and examples please refer to:
      http://www.php.net/mysql_query

      for update, what you have is completely wrong. What you want to do is update the record pointed to by $id with the values that are currently in the class attributes. For this you will use the mysql update command and the php mysql_query function.

      For more information on this function and examples please refer to:
      http://www.php.net/mysql_query

      for delrec, again this is completely wrong. You want to use the sql DELETE function to delete the record pointed to by the $id variable.

      For more information and examples refer to:
      [url]http:///www.php.net/mysql_query[/url]

      for retrieve, you will use the select command of sql and the mysql_query function of php to retrieve the record pointed to by $id into the class attributes.

      Once you've gotten these we'll move onto IDList and Search.

        Ok,

        I got alot of work on my plate reading all this.

        Will catch you tommorow with a completed functions.
        I think I grasp what your saying now, or at least partialy!

        Later.

          I think I have it right now!

          Check it out!

            Your close to having the basic functions down. The only two corrections are

            1) return a 1 for success not a 0
            2) $this->BillName not $BillName. $BillName is a variable local to this function $this->BillName is a class attribute.

            now once you have the corrections in place for the basic functions let's think of a couple of things.

            1) what if an invalid key is specified in $id?
            2) do you really want to die on the user or do you want to keep running and show them a nicely formatted error?
            3) how can you use the functions in dbAccess to get the mysql_ commands out of this file?
            4) is there an easy, or have you already coded a, method for error checking what the user provides to $id?

              Originally posted by drawmack
              Your close to having the basic functions down. The only two corrections are

              1) return a 1 for success not a 0
              2) $this->BillName not $BillName. $BillName is a variable local to this function $this->BillName is a class attribute.

              Ok, I think I corrected the problem. see the attachement.

              Originally posted by drawmack

              now once you have the corrections in place for the basic functions let's think of a couple of things.

              1) what if an invalid key is specified in $id?

              See attachement.

              2) do you really want to die on the user or do you want to keep running and show them a nicely formatted error?

              See attachement

              3) how can you use the functions in dbAccess to get the mysql_ commands out of this file?

              Don't know !

              4) is there an easy, or have you already coded a, method for error checking what the user provides to $id?

              hmmmmm, not sure how to do that!

                What happens when a query fails even if the id checks out, like say the rest of the data is screwy?

                  didn't you catch and report failed queries in dbaccess? don't you think you should do the same thing here?

                    If this is what your talking about, the function has no code in it.

                    Snip from dbAccess.php

                    function dbAccess() {
                    /*This is the constructor function which is automatically executed whenever
                    we create a new instance of this class.

                        This particular class requires no instantiation but this function is included
                        for completeness*/
                        } //end dbAccess

                    If this is not, then I don't understand what your getting at or what part of code you mean. Sorry!

                      Do you mean, for example, change this:

                      						 $this->error = "Invalid variable ($ID) passed to DelRec. <br>\n";
                      

                      To be this:

                      $this->error = "Invalid variable ($ID) passed to DelRec: " . __FILE__ . " on line " . __LINE__ . mysql_error(); 
                      

                        do me a favor upload your most recent dbBills.php file please?

                          for example you have this:

                          function Retrieve ($id) {
                            if (!is_numeric($id)){
                              $this->error = "Invalid variable ($ID) passed to Retreive. <br>\n";
                              return 0;
                            } else {
                              mysql_query("SELECT * FROM DB_NAME WHERE ID = '$this->ID'")
                              return 1;
                            }
                          } //end Retrieve

                          you should have this:

                          function Retrieve ($id) {
                            if (!is_numeric($id)){
                              $this->error = "Invalid variable ($ID) passed to Retreive. <br>\n";
                              return 0;
                            } elseif (mysql_query("SELECT * FROM DB_NAME WHERE ID = '$this->ID'")) {
                            return 1;
                            } else {
                              $this->error = mysql_errno() . ": " . mysql_error();
                              return 0;
                          } //end Retrieve

                            ok so is this correct?

                            See attachement

                              very very very close,

                                function Retrieve ($id) { 
                                 //here you check the $id parameter
                                  if (!is_numeric($id)){
                                    $this->error = "Invalid variable ($ID) passed to Retreive. <br>\n"; 
                                    return 0; 
                                  //but here you use the ID class attribute
                                  } elseif (mysql_query("SELECT * FROM DB_NAME WHERE ID = '$this->ID'")) { 
                                    return 1; 
                                  } else { 
                                    $this->error = mysql_errno() . ": " . mysql_error(); 
                                    return 0;
                                  } 
                                //end Retrieve
                              

                              You have to make them agree. I would assign the $id parameter to the ID class attribute as the first test. This will allow you to take advantage of the error checking you already programmed into set. Just remember that class methods need to be called the same way as class attributes so $this->func()

                                I don't see the difference between my file and your example ?

                                What was changed?

                                  nothing except the comments to tell you what you're doing wrong.