View Single Post
Old 07-12-2005, 12:23 PM   #3 (permalink)
metazai
Regular Contributor
 
Join Date: Apr 2004
Location: Orange County, CA
Posts: 124
metazai is on a distinguished road
Cool. I think I . . . almost get it. I don't feel so bad not know what it was now that I know it was OOP, which I'd understood was a method of coding PHP but not one I've used, not coming from a java/C/coder background. Be forewarned you will be seeing further questions on this board from me in the coming weeks.

One question now from the brief but hightly informative article you wrote . . . in the function "article", you have
Code:
  function article($id) 
  { 
    $result=mysql_query("select * from articles where id='" . $id . "'"); 
     
    // when defining variables that belong to this class, while inside the class, 
    // use 'this->' before the variable name. 
    $this->id = $id; 
    $this->headline = mysql_result($result,0,"headline");
I'm assuming that $this->headline would get the result from the matching id query, so you could spell that line out like so:

"$this->headline is a class variable that is equal to the data marked "headline" which was pulled from the proper id tag in the query"

But what's the ",0," in the middle for?

Also, unless you don't think it belongs here, using the same example how would you pull an array? Or is that what the "0" indicates?
metazai is offline   Reply With Quote