Jump to content

blurredvision

Members
  • Posts

    59
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

blurredvision's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks guys. I used Ken's script to great success, and I'll dissect it to implement it into my knowledge.
  2. I'm needing to create links to bring back the previous month and year in just their numbers. I think it has to be done using something like mktime(), but I'm not at all familiar with it. I'd like the cleanest possible solution, so that's why I'm asking you guys for help. Today is June 1st, 2009. Or, 6-2009. I'd like a quick variable that will bring me 5-2009 (ideally, the month number and year would be separate variables). So in my perfect world, I'd end up with $prev_month = 5; and $year = 2009;. If today were January 15th, 2009, I'd want to end up with $prev_month = 12; and $year = 2008;. Pretty simple, but I don't have any idea how to do it. Do I use mktime(), or can I do some kind of date('n') -1;? I appreciate the help and learning!
  3. I have a MySQL table that has a column for dates, and they are in this format: YYYY-MM-DD The column has the DATE data type. The database will always have dates older than today, but will only have at most 14 dates into the future for certain events. What I'm wanting to do is populate a drop down box in one of my forms that will only show today's date along with any dates forthcoming. Dates older than today I do not want. So, for example, today is 2009-05-29. I have a column with the following dates: 2009-05-21 2009-05-23 2009-05-28 2009-05-31 2009-06-02 2009-06-04 2009-06-07 From my explanation, I only want to bring back events that may happen today, as well as any future event dates. What is the best way to go about this? Let's just say that having the event dates in this format is the ONLY way that they can be entered into the database, so anything I do will have to use the above example format. I appreciate any suggestions.
  4. Figured out what I was doing wrong. I was completely forgetting to pass the $value into the function. What a stupid oversight. I was so stuck on trying to find through google if it was correct syntax or not that I didn't look at other factors. Thanks flyhoney, sorry to waste your time.
  5. There is an underscore. Other than that, just letters and a single number. I'm getting part of the string through a function argument, then concatenating a number on to the end. Maybe that's messing with it somehow?
  6. It's definitely a string. I've even echoed the variable to make sure it's showing how I want it, and it is. The cookie just doesn't create. Is my syntax correct?
  7. I have a cookie that I'm setting like such: setcookie("cookiename", $value, time()+3600*24*5); That works perfectly fine. However, I'm now wanting to create my cookie in a different way, by using a variable to set the name of the cookie. Here's what I'd like to do: setcookie($cookie1, $value, time()+3600*24*5); I cannot get that work. Can you not use a variable to set the cookie name, or is my syntax wrong?
  8. I have a project where I'm needing to change the value of an already existing cookie, but I have a set expiry date that I don't want to change. For example, I have a cookie that has a value of 'car', and is set to last for one hour. setcookie("cookie1", "car", time()+3600); In 20 minutes, I will want to change $_COOKIE['cookie1'] from 'car' to 'truck'. BUT, I want to make sure that the cookie will still cease to exist in 40 minutes and not reset back to an hour when I update the cookie with a new value. How do I do this, or can I do this? I've not had much experience with cookies, so thanks for any learning .
  9. I haven't quite learned expressions yet, so I was hoping somebody could quickly give me the right to code to check a variable for the absence of a period. Thanks!
  10. Currently, I'm pulling a column from a table in mysql based on whether a user is active or not. If a user is active, then it will return a value from a column. I'm wanting to check against each value in the array that is created, and if none of them match what I'm looking for, then I want to echo some text. Here's what I've written, but I do know that it's wrong where I'm trying the IF function. I'm posting this just to kind of show you what I'm trying to do, and hopefully you guys can show me what the correct syntax is to check against the entire array. I tried doing a WHILE and running through the array, but it obviously would echo the contents multiple times for however many keys were in the array. EDIT: The $matchups array is one that is created before getting to this block of code....this block of code is in a while loop, just to give you some perspective. $query = "SELECT team,gamertag,active_status FROM user"; $queryresult = mysqli_query($dbc, $query) OR die(); $hpu = mysqli_fetch_array($queryresult); if ($matchups['active_status'] == 1) { if ($matchups['opponent'] != $hpu['team']) { echo '<span class="enterstats">'; echo '- ' . $matchups['team'] . ' (' . $matchups['gamertag'] . ') vs ' . $matchups['opponent']; echo '</span><br />'; } } Thanks for any advice!
  11. EDIT: Nevermind, figured out what I was doing wrong. I have a leaders table on my site that pulls data from a field in my database. I limit it to pulling the top 5 in a descending order. The field is set up to be a TINYINT (not unsigned) with 3 characters. Integers are stored as, for example, 5 for a positive number, -5 when it's a negative number. Pretty simple stuff. So I have my query: $leadersquery1 = "SELECT gamertag_id,turnover_ratio FROM league_leaders WHERE season=$currentseason ORDER BY turnover_ratio DESC LIMIT 5"; At the moment, it should be pulling the following: 4, 3, 1, 0, 0. However, it's only pulling the 4, 3, and 1, and it's not showing the 0's. Am I glancing over something, or do I need to provide more info? I've also tried setting a column type of FLOAT, but it simply does the same thing.
  12. Well, this worked perfectly fine, so I think I'll go with it. Thanks iceblox!
  13. Sorry, completely forgot the query . This is the one for the total offensive stats. $leadersquery1 = "SELECT gamertag_id,total_offense FROM league_leaders WHERE season=$currentseason ORDER BY total_offense DESC LIMIT 12"; $leadersrun1 = mysqli_query($dbc, $leadersquery1);
×
×
  • 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.