Jump to content

web4

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

web4's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi i've been thinkign this in 1 day already and i think i need some help Here's a code that need to be revised <?php /*** a simple string ***/ $string = 'samples7'; /*** try to match letters with single number in it but limited to 8 characters and not less than 5 characters ***/ if(preg_match("/([a-zA-Z]+?=\d){5,8}$/", $string)) { /*** if we find the word white, not followed by house ***/ echo 'Found a match'; } else { /*** if no match is found ***/ echo 'No match found'; } ?> How could i revised that code to work correctly? Thanks
  2. web4

    Help in OOP

    Thank you guys that was much clear. Thank you Andy-H,ignace, Nightslyr
  3. web4

    Help in OOP

    thanks for your reply only one questions remains in mind... echo $mammal->species = 'Whale'; //fatal error i wonder why the error is fatal because the definition of "private" is methods and properties are only visible within the class that defines them however that declaration (in my understanding and i know it is wrong and it needs to be clear up) it shouldn't have a fatal error because $mammal->species that code $mammal is a class right? then we access the private variable with the "same class" through $mammal->species and it shouldn't have an error because this doesn't violate the private definition because i use $mammal->species to access the private variable which means the same class...i hope i deliver it clearly my question...
  4. echo "<td width='101px' height='101px' >$j</td>\n"; in that line you should use a different variable instead of $j because $j will always reset to one you could have a code there for($j=1;$j<=$cols;$j++) { echo "<td width='101px' height='101px' >$counter</td>\n"; $counter++; } you should declare the $counter variable outside the loops
  5. web4

    Help in OOP

    Thanks for your reply but in the human class with the declaration $human->species = 'Boy'; it tries to access the species private variable and thus must have an fatal error... cause from my learning OOP i thought that if you have a parent class and a child class you can inherit the properties of the parent class(ex..all the variables are public) and my conclusion to that is you can access variables in parent class using the child class )
  6. very Good you have found the error i was reading a document that's why i haven't replied immediately to your post. Mark this post as solved please
  7. i'll try once again in your code if($slot["4"] == "") i think $slot is equal to '' and when you try the condition on if($slot["4"] == $mixologist) it is false because $mixologist = $row[djname]; is not equal to ''
  8. I'll just try... why don't put $fill = $row[filling]; a quotation inside the array? $fill = $row["filling"];
  9. /* /* "Private" methods and properties are only visible within the class that defines them, /* "Protected" methods and properties are visible to both their defining class and any /* child(inherited) classes. /* Attempts to access these properties or methods outside their visible area typically /* produces a fatal error that stops script execution. /* /* /* */ <?php class Mammal { public $name; protected $age; private $species; } class Human extends Mammal { } $mammal = new Mammal; echo $mammal->name = 'William'; //ok echo $mammal->age = 3; //fatal error echo $mammal->species = 'Whale'; //fatal error $human = new Human; echo $human->name = 'Barry'; //ok echo $human->age = 1; //fatal error echo $human->species = 'Boy'; //undefined ?> I am confuse on that example about OOP can anyone explain to me why the $mammal->species = 'Whale'; gets fatal error and $human->species = 'Boy'; gets undefined only? because they are the same private and if you get the definition of private from the comments above private is only "visible on it's class only" and so in the code $human->species = 'Boy'; should get also fatal error because the species variable is private to mammal class and even though it is inherited by the human class it should get fatal error because species is private in mammal class.. I hope i delivered my question clearly thanks.
  10. web4

    Recursion

    Yes i know that...actually if you run that code...only the upper part will appear... i've didn't post the other codes...i solved it on my own...anyways thanks for the reply
  11. Okay then try this...before the loop... $scoresb = mysql_fetch_array($scoresq); then... var_dump($scoresb); if it says something bool(false) then you know what is wrong...
  12. Yes, 182guy is correct you can change the code in his other post..
  13. but first change it to id sometimes php is "case sensitive" then tell us what's wrong when you already changed it
  14. then that's seems okay....now my next guess is your $scoresb['ID']; <--- ID is not a valid field of your table scores....
  15. why not trying the source first?? var_dump($scoresq); ?? then tell us what the var_dump tells about the resource...copy and paste it here
×
×
  • 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.