Jump to content

eldan88

Members
  • Posts

    488
  • Joined

  • Last visited

About eldan88

  • Birthday 04/24/1988

Profile Information

  • Gender
    Male
  • Location
    New York

Contact Methods

  • Skype
    eldan88

eldan88's Achievements

Advanced Member

Advanced Member (4/5)

1

Reputation

  1. Nevermind. There was another file that that was included, using the same code which didn't have a $_GET that wasn't set
  2. Hey Guys, I have a simple if/else condition, and I keep getting an error "Undefined index: store" . I was wondering why its giving me thar error with the first if statment evalutes to true?? . Below is my code. Thanks! if(isset($_SESSION['store'])){ $store_name = $_SESSION['store']; } else { $store_name = trim($_GET["store"],"/"); }
  3. KevinM1. Oh okay I see what you are saying. I was reading about enterprise patterns in the book you actually recommeded me to read... (PHP Objetcs, Patterns, and Practice by Matt Zandstra) and the layout just looked very similar to your typical MVC structure..
  4. Hey Guys. I am learning about the Enterprise pattern, and to me it seems like its the same as the MVC pattern (which I learned about) Do they work the same?? For those who know Martin Fowler's Patterns of Enterprise Application Structure, that is what I am referring to as the enterprise pattern
  5. I am echoing out 2 radio input fields in a foreach statement. I would like to have the first option checked in all the radio input fields that gets echoed out. But for some reason it marks the radio input field "checked" all the way in the bottom. (The last one) How can I make it so that every input field that gets echoed out will be marked checked? Below is my code. Thank you for your help foreach ($menu_cat_options as $menu_cat_option){ <input type="radio" checked="checked" name="display_type" value="radio" >Radio <br> <input type="radio" name="display_type" value="checkbox">Check Box }
  6. Hey Guys. I am trying to create a time dropdown and increment eat by an an hour until it is lless than or equal to the end time. I am using the DateTime class to accomplish this. Now when I am trying to use a for loop to accompish this it does not work. Can anyone please help me out with this issue? Below is the code that I have $start_hour = new DateTime("now",new DateTimeZone("America/New_York")); $start_hour->setTime(6,00); $formatted_start_time = $start_hour->format("H:i:s"); $end_hour = mktime(11,45); for($start_hour; $start_hour <= $end_hour; $start_hour->modify("+60 minutes"));{ echo "<select name='cat_display_timeslot'>"; echo "<option>{$formatted_start_time}</option>"; echo "</select>"; } Thanks!
  7. Ahh okay. I was thinking there was a way to do it inside the abstract class. But that makes sense. Thank you
  8. Hey Guys. I am across this in a book and I am having a hard time understanding how I can try/catch this expception The code below will throw an exception if I add an unit object into Archer or LaserCannon object. Here is a quick example class UnitException extends Exception{} abstract class Unit{ function AddUnit(Unit $unit){ throw new UnitException(get_class($this)."is a leaf"); } function removeUnit(Unit $unit){ throw new UnitException(get_class($this)."is a leaf"); } abstract function bombardStrength(); } class Archer extends Unit { function bombardStrength(){ return 4; } } class LaserCannonUnit extends Unit { function bombardStrength(){ return 44; } } $laser_cannon = new LaserCannonUnit(); $laser_cannon->AddUnit(New Archer()); // This is not allowed When I run the client code I get the following error message Fatal error: Uncaught exception 'UnitException' with message 'LaserCannonUnitis a leaf' Can any please help me understand this?? Thanks!
  9. ahhh okay. I got it now. Thank you so much for making it more clear to me now
  10. Hey Barand. Thanks for providing the example. I understand it a little better, but I am stilll a little bit confused in some parts. 1) I don't understand how $a > $b if they are both strings and not numbers 2) Why would a negative number be sorted above $b isn't supposed to be below be since it a negative number? For example in the follwing example, how can $a be greater, less than or equal to $b?? .... That's what confuses me the most $a = array("Alex","jon"); $b = array("Mike", "jon"); echo "<pre>"; print_r(array_udiff($a,$b,function($a,$b){ if ($a < $b) { fb("I am coming out of the if (a < b)"); return -1; } elseif ($a > $b) { fb("I am coming out of the a > b"); return 1; } else { fb("I am coming out of the else"); return 0; }; }));
  11. Hey Barand, Thanks for the explination but I still can't seem to figure it out. What do you mean exactly by "Sort Above" also why would it sore above if its a negative number??? Also how is it logically possible to check if $a is greater than $b???
  12. Hey Guys. I am trying to understand how the array_udiff works but I am having a hard time understanding why the call back function returns a interger? How does that return value preform the camparison? For example in the code below, what does the return 0 , or return 1 or -1 have anything to do with the comparison? Thank you in advance! function myfunction($a,$b) { if ($a===$b) { return 0; } return ($a>$b)?1:-1; } $a1=array("a"=>"red","b"=>"green","c"=>"blue"); $a2=array("a"=>"blue","b"=>"black","e"=>"blue"); $result=array_udiff($a1,$a2,"myfunction"); print_r($result);
  13. Hey cyberRobot and Zane. I realized it was a problem with the width on the left frame. I took down 1% and it shows on the right frame now. From some reason when I added the "/n" it didn't fit in the right frame, until I changed with wdith to 34% from 35%
  14. Hey Guys. I am using php to output to frames. When I add an "\n" tag of even a PHP_EOL the second frame shows blank. The weird thing is when I view the page source I can clearly see the HTML of both frames... Can anyone help me resolve this issue? Thanks! $iframe = "<iframe src='menu_new.php' width='65%' name='menu' id='menu' title='Menu Frame' ></iframe>\n"; //iframe not working when adding the /n on this line $iframe .= "<iframe src='menu-items.php' width='35%' name='menu-items' id='menu-items' scrolling='yes' noresize='noresize' title='Menu Items Frame'></iframe>\n"; echo $iframe;
×
×
  • 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.