Jump to content


  • Posts

  • Joined

  • Last visited

ThePsion5's Achievements


Member (2/7)



  1. I could do that, but the form I'm creating has the labels on the left side and the input elements on the right side. Here's a sample of the HTML:<label for="first_name">First Name</label><input type="text" id="first_name" /><br /><label for="last_name">Last Name</label><input type="text" id="first_name" /><br /><label for="address1">Address</label><input type="text" id="address1" /> The idea behind my CSS is that I can have the labels be the same width so the form input elements are all aligned from the left side (without using any form of tables). Any ideas?
  2. Hi,I'm creating a form and I want to set the width of all labels for that form. I assumed that the CSS for this would be quite simple: label{width: 250px;} But this code doesn't work at all - at least not in the latest version of Firefox. Any ideas what I may be doing wrong and the proper way to go about this? Thanks!
  3. Okay, I think I figured it out, although my method seems to be fairly inefficient: $IsAM = false; $Hour = $input; $NextHour = $input+1; $r; //Reset the next hour to zero if needed if($NextHour == 24) $NextHour = 0; //Check the current hour if($Hour < 12) $IsAM = true; if($input > 12) $Hour -= 12; if($IsAM && $Hour==0) $Hour = 12; if($IsAM) $r = $Hour . ' AM to '; else $r = $Hour . ' PM to '; //Check the next hour $IsAM = false; if($NextHour < 12) $IsAM = true; if($NextHour > 12) $NextHour -= 12; //Turn '0 AM' into '12 AM' if($IsAM && $NextHour==0) $NextHour = 12; if($IsAM) $r .= $NextHour . ' AM'; else $r .= $NextHour . ' PM'; return $r;
  4. Hi guys,I'm working on a function to take a hour number (0-23) and turn it into a more human-readable format (12AM-11PM), and I'm having a hard time creating a function that does it properly. When functioning properly, it should turn this: Into this: Here's my current function, which works most of the time but still screws up in some places:$IsAM = false; $Hour = $input; $NextHour = $input+1; $r; //Check the current hour if($Hour < 12) $IsAM = true; if($input > 12) $Hour -= 12; if($IsAM) $r = $Hour . ' AM to '; else $r = $Hour . ' PM to '; //Check the next hour if($NextHour < 12) $IsAM = true; if($NextHour > 12) $NextHour -= 12; if($IsAM) $r .= $NextHour . ' AM'; else $r .= $NextHour . ' PM'; What am I missing?Thanks in advance for the help!
  5. I'm trying to get an entire series of dates, though, not just a single date. For example:
  6. Hi,I'm trying to create an SQL statement that will return the total amount of money earned in a specific time period such as per day/per week/ per month. Here's the relevant table columns: table(amount INT NOT NULL,insert_dt DATETIME NOT NULL) And here's the SQL statement I want to use: SELECT SUM(amount) FROM table GROUP BY ? I seem to recall that this is possible, but how? Unfortunately my SQL is a bit rusty.
  7. I did, and it's returning a boolean (true) value. Very strange...
  8. Hi guys. I'm writing a PHP script that involves creating and then accessing a file. I'm running into a strange problem, however: when I use fopen() to open the file, it succeeds (does not generate any warnings/errors) but instead of returning a file handle, it returns 1/true. Any idea what might be causing this? if(!file_exists($Filename)) //Create the file handle $FileHandle = fopen($Filename, 'w'); //If the file could not be opened or created, throw an exception print_r($FileHandle); //PROBLEM: Prints 1 instead of the file handle if(!$FileHandle) throw new Exception('Unable to create or open the following file for writing: "'.$Filename. '" in directory "'.$this->CacheFileLocation.'"'); else { //Save the data in the file fwrite($FileHandle, $Content); //Here i get an error saying that "$FileHandle" is not a valid resource //Close the file stream handle fclose($FileHandle); //Same here }
  9. Hi guys,I'm trying to find a PHP IDE that would allow me to directly work with files on a server that I would connect to via SCP/SFTP or SSL - any ideas? So far my searches haven't turned up anything.
  10. ThePsion5

    help me

    You should also use mysql_real_escape_string to prevent SQL injection attacks as well.
  11. Also, i would advise that you escape your input variable before you run the query...don't want some hacker destroying your site, lol.
  12. Unfortuantely, it's not a function issue as much as an object handling issue...I always use alot of OO in my design and I want to make sure that it'll work on PHP4. On top of the pain of not being able to create interfaces, abstract classes, and type hinting, heh.
  13. Hi guys,I'm developing on a machine that is currently running PHP5, but the product i'm developing for will be a PHP4-exclusive one; sadly, switching PHP installations on this machine has proven a significant pain in the arse so I was wondering if there was some way i could force PHP5 to look and act like PHP4. Any ideas?Thanks in Advance,Sean
  14. I wouldn't say that conclusively...after all, look at how much closer to Java and C++ PHP5 is compared to PHP4...give it a few years and I bet it'll catch up. I've actually toyed with the idea of using javascript written by PHP code...havn't tried it yet though.
  15. Sure, I realize now that I should have clarified.Normally, if I want to create a class that uses other classes, I would create an interface for those classes. I'm going to create a better example here: interface Cargo{ function getDimensions($format); function isFragile(); function getWeight($format);}class CargoCarrier{ function addCargo(Cargo $Added) { $Weight = $Added->getWeight('metric'); ...(do other stuff)... }} This way, using the (Cargo $Added) line, i'm specifying that the variable $Added must contain an object that conforms to the Cargo Interface. However, i want to use a static class the same way: turns into To do this, I need to change the CargoClass section of the code, but i have no idea how to do that. Does that explain my problem a bit more clearly? Thanks!
  • Create New...