Jump to content

mkosmosports

Members
  • Posts

    196
  • Joined

  • Last visited

    Never

Everything posted by mkosmosports

  1. I knew there was something simpler around..... :P Thanks Jenk. I will use your alternative solution.
  2. Nevermind, the below script is working for me... :D   $full_path = getenv("REQUEST_URI"); //retrieves the full url   $pagename = basename($full_path); //retrieves the name of the html page youre using (with or without any url parameters)....   $currentt = substr($pagename //makes sure only the html page name getx extracted...   , strrpos($pagename, "/")   , strpos($pagename, ".html")); The above variable $currentt will extract the name of the current html page thats being used and nothing but....
  3. I have the following variable defintition : $currentt = $_SERVER['REQUEST_URI']; echoing this gives me the current URL that is being used. However, I would like to get it to only show the name of the html page that is being used. For example, currently if the url is "http://localhost/index.htm?g=2&h=4", and I echo $currentt I want it only to return "index.htm" not the entire url... Does anyone know of a way that this can be done? Thanks. mkosmosports
  4. "Wait, just noticed something. How are you planning on passing parameters on a .html file? I didn't know that could be done." All my templates are html files and passing parameters work flawlessly. I always thought it didnt matter whether the extension is .php or .html.... I see your solution to my problem though, using a template variable, this sound like what I need to do. Thanks hostfreak. I will try this as soon as I get home again later today.... mkosmosports
  5. Thanks Crayon Violent. I will indeed try this and post the results when its all done!
  6. I have a database full of teams and dates when the teams start out. For this particular tournament teams enter at 4 different stages (dates)... What is quicker? 1. Do four different mysql queries which would return only the teams during selected date intervals? 2. Do one query which would return all teams and then use php to separate out what is to be returned when? Thanks..
  7. Ive been looking into it yes. But the thing thats been perplexing me though is how to be able to pull the name of the html template which is currently being looked at using some kind of a function maybe. If I was able to do that the rest would be simple...
  8. Hmm...no answer in a couple of days... :-\..maybe Ive confused everyone with the question. Does anyone understand what Im trying achieve and does it sound at all possible?
  9. How come I am unable to write the following code: while ( $row = mysql_fetch_array($result7) ) || ( $row = mysql_fetch_array($result71) )? Thanks.
  10. Hey Everyone, Im trying to write a condition based on what html termplate is being used at that moment. I have 6 different templates though and I want to avoid needing to rewrite the condition six times just to accomodate these six html templates. Here is an example of code for one of the conditions...     if ($groupid == "9" || $groupid == "11")     {    echo("<div style=\"background: #70A2D7 url(images/pastyears.jpg) no-repeat top\">           <form name=\"CommonDrop\">             <select name=\"DropSelect\" onchange=\"go()\" style=\"font-size: 14px; margin-top: 30px\">                   <option selected value=\"#\">--Select--</option>                   <option value=\"ghome.html?group=9&season=2006\">2006</option>                   <option value=\"ghome.html?group=11&season=2002\">2002</option>             </select>           </form>     </div>");} Now, I want the same condition for when the user visits "teams.html" as opposed to "ghome.html" but I dont want to have to rewrite the above condition again to just replace the html template name. Is there some way I can use a variable there which would define the html template that the user is currently visiting, such as <option value=\"$currenthtml?group=9&season=2006\">...but what would that variable have to be defined as? Any help is much appreciated... mkosmosports
  11. Thanks craygo for your advice. For the needs of my project however, it looks like storing the duplicate html/php code in separate php files and the simply calling on it via include is working out perfectly (without the use of functions)! Ive got one separate php file per duplicate script. This will save me so much time, and its working flawlessly... Do you see any disadvantages to doing this? The only one I see is that I need separate php files for each piece of code that needs to be used (Although I have heard from others that including one php file per html page is actually not a good idea, so maybe this is not a disdvantage. From a workload standpoint it is at most a minor inconvenience anyhow.) Thanks...
  12. Mornin Masna, I do understand what you mean, I appreciate your help. The thing is, I have a lot of duplicate scripts in several html files. These scripts do use quite a few variables that would need to be repeated constantly and I dunno if turning on GLOBAL is a good idea. Is it a reasonable solution to include the scripts that get duplicated in a separate php file each (would give me around 5-8 separate php files and then simply call on the different files when needed? Thanks for you expert advice....
  13. Alright, I got it to work, but is this true that everytime you write a new function, you need to rewrite all variables and parameters used in the function??!! How come they are not retained? Is there a way I can just declare each variable once per html page and not need to call on them everytime they need to be used? Thanks.
  14. Hmm...still having issues with this. I have a file sitting in the same directory as the html file, called "func.php" Inside I have a simple function: <? function writeMyName()   {   echo "Jim Johnson";   } ?> Then, in my html page I say: <?php include("func.php");                 writeMyName(); ?> This returns an error however, saying "Fatal error: Call to undefined function writeMyName() in" If I simply wanted to call on this function which writes my name, how would I do it. Can someone be kind enough to simply write it out so I could understand it? Thanks!
  15. Hey Everyone, How can I link to an external php file containing functions that I want to be able to call on at any point in time? PS. Sorry about the strange original post. Im having some issues posting. Thanks! mkosmosports
  16. ha...youre so right. how did this not occur to me..&& is the correct operator here not ||.... Thanks Timbo
  17. Ive got the strangest issue and Ive spent the last few hours on it!! Ive got this condition: if ($group != "13" && $season <= "2005")   {     header('Location: error.html');   } This works great, but wait, there is another group variable for which I want the season variable to be able to go lower than 2005. Logically, I would try the below condition.... if ($group != "13" || $group != "14") && $season <= "2005")   {     header('Location: error.html');   } But now, the "unless the groups are NOT 13 OR 14" condition does not work anymore. The second condition is the only one that works correctly. Is there a rule where you cannot have if (NOT EQUAL or NOT EQUAL)? Thanks for any advice.... mkosmosports
  18. Thanks a lot for your help guys, I've tried the suggested methods and one of them works just the way I want it!
  19. Hello, Does anyone know how to invoke a redirect to another html page (error page) based on the condition that a user selects certain variables in the URL. I know an if statement would have to be used, and I would use "if $variable =>.." so greater than or equal to. But I cant think of a way to invoke the redirect..... Any suggestions? Thanks a lot, mkosmosports
  20. Hey Orio, Thanks for the response... Using your below code I now have                   <?php   $newseason=strtotime("+6 months");   date("Y", $newseason);                   echo("<li><a href=\"leaguehome.html?group=1&season=$newseason\">English Premiership</a></li>                   ?> However, the $newseason variable returns wild numbers like 1167347827, etc. Any ideas why?
  21. Hey all, Im working on a soccer site and I want php to dynamically produce the current year as part of a URL variable when they look at data from a specific season. Easy enough right:                   $thisyear=date('Y');                   echo("<li><a href=\"leaguehome.html?group=1&season=$thisyear\">Premiership</a></li> The problem is, because a soccer season lies over two years, when 2007 rolls around and the season variable will equal 2007, the mysql query would try to get data from the 2007 season, which isnt there yet. I would need a small php function which would for example tell 2006 to run from Aug. 2006 to July 2007 as opposed to Jan.2006 to Dec.2006, so that when the $thisyear variable stays at 2006 until July 2007 when it would change over to 2007..... I know I maybe be confusing to read (php beginner) but if someone understands what I mean, I would appreciate any help or advice... Thanks! mkosmosports
×
×
  • 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.