Jump to content

blackcell

Members
  • Posts

    439
  • Joined

  • Last visited

Everything posted by blackcell

  1. You can name the page as index.php and the url as the directory name. Say you want to type www.something.com/members to take you to a members area. Just create a subdirectory of your site's root dir named members and the initial page that loads within that directory as index.php. Not totally sure this is good structuring practice on the internet side but it is the way we design our web based programs at my company.
  2. Are you trying to do this with PHP? It looks like all html. If your trying to make a determination on how to output a Grade letter depending on a number, I would use a few traps like: if($gradeNumber < 60)$gradeLetter = "F"; if($gradeNumber >= 60)$gradeLetter = "D"; if($gradeNumber => 70)$gradeLetter = "C"; if($gradeNumber => 80)$gradeLetter = "B"; if($gradeNumber => 90)$gradeLetter = "A"; Since PHP executes Top-Down, it may satisfy more than one of the above statements but it end up with the correct Letter Grade. If system optimization is an issue you may want to use a more sophisticated statement. If your doing multiple classes, just set a few variables and average the overall by the number of classes. $classesNumber = 6; $class1 = 70; $class2 = 90; $class3 = 80; $class4 = 60; $class5 = 90; $class6 = 80; $gradeNumber = ($class1 + $class2 + $class3 + $class4 + $class5 + $class6) / $classesNumber; f($gradeNumber < 60)$gradeLetter = "F"; if($gradeNumber >= 60)$gradeLetter = "D"; if($gradeNumber => 70)$gradeLetter = "C"; if($gradeNumber => 80)$gradeLetter = "B"; if($gradeNumber => 90)$gradeLetter = "A"; //Display Final Grade Letter echo"$gradeLetter"; I don't know if this answered your question.
  3. Hello all, I have been programming in PHP for a short while. Four months would be an accurate count. I usually mess with it on a daily basis at work and have created multiple programs that depend on pulling, manipulating, and displaying data from a mysql database. I am barely familiar with oop and classes but wish to learn more. This leads me to the ultimate question that has had me wondering all day. What exactly is "->"? I see it in classes and in gnuPHP and I am curious if it has to do with OOP in PHP. I would also like to know more about OOP in php and would like to know if anybody has any good online OOP with PHP reads. Thanks in advance.
  4. mktime will get the timestamp for the date and strtotime will convert about anything you can imagine into unix timestamp.
  5. strtotime is the method of getting a unix time stamp. PHP Manual has great information on how to use it and pull the string out of a timestamp into regular time.
  6. That was almost it. It's been a long day and I had my sql query structure misunderstood. I think I have it now that you posted that and jarred my head. Thanks.
  7. Hey, I am fairly new to PHP, but I have completed a few date comparison projects as of late. I usually pick the dates apart into $current_month, $current_day, $current_year variables. I do the same with desired month, date year. Then I use if statements to compare the two and throw errors accordingly. See below: <?PHP //Lets breakdown the Current Date. If you are using a different date structure, modify the substr accordingly. //If you need more help on substr, search PHP substr on google and click the first link. $current_date = date("mdy"); //These three lines pull the year, date and month into seperate variables to work with. $current_m = substr($current_date,0,2); $current_d = substr($current_date,2,2); $current_y = substr($current_date,4,2); //Lets breakdown the Target Date I am replacing the / with nothing because it is less confusing and the numbers //are the same as above. $target_date = "12/20/07"; $target_date = trim(str_replace("/","",$target_date)); $target_m = substr($target_date,0,2); $target_d = substr($target_date,2,2); $target_y = substr($target_date,4,2); //Now your months, days, and years are broken into seperate variables. This can be accomplished with arrays too //but this is easier if your not familiar with arrays. //Lets set some error messages to tell us why we are being rejected! $error_y = "You have selected a year in the past."; $error_m= "You have selected a month in the past."; $error_d = "You have selected a day in the past."; //Lets test to see if the target date is before the current date. if($target_y > $current_y){ if($target_m > $current_m){ if($target_d > $current_d){ echo "SUCCESS! You have selected a date that is not today or before today but in the future!"; }else{ echo $error_d; } }else{ echo $error_m; } }else{ echo $error_y; } ?> Let me know if this helps.
  8. -Version 5.0.27 -statement: //trying to figure it out -error return: //none yet -Structure{ ----------------------------------------------------------------- group1 group2 group3 group4 group5 group6 group7 | right1 * * * * * | right2 * * * * | right3 * * * | right4 * * * | ----------------------------------------------------------------- } -What I want to to happen{ I am organizing somebody's mess of group rights. Basically the rights are to a program and it inhibits/allows users to have menu items such as print or print preview in the File drop-down menu of your browser. If field has an "x" in the database{ my browser program displays a green "x" indicating they have the right }else{ it is blank. } All of that works. I am wanting to click the group name which is a link to another page that will un-post the passed variable(group name) and use that name to display only the group field of every option. In short, the possible rights to have access are the database records and the groups are the database fields. I want to view only the field I request of every record in the database. Don't bother attempting to grill me on database design and telling me I designed it completely backwards because the right way wasn't practical with the amount of data I am manipulating and the fashion in which I am having to work with it. } //Your help is greatly appreciated.
×
×
  • 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.