Jump to content
Larry Ullman's Book Forums

Steve Wilkison

Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by Steve Wilkison

  1. I'm hoping someone might be able to help me with a new problem that has arisen on one of the sites I maintain. I'm getting a PHP error that says:

     

    "It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead."

     

    The funny thing is, the code has been in place for years and we've never gotten these errors. Suddenly they began popping up. I'm guessing maybe the host did an upgrade the the PHP version on the servers, but don't know for sure.

     

    I have a php.ini file for the site and it in I have tried everything I can think of, including:

     

    date.timezone=UTC

    date.timezone=America/Chicago

    date.timezone=US/Central

     

    When I look at the phpinfo() file the changes I make in my php.ini file are reflected, but I still get this error. What am I doing wrong? Any advice would be greatly appreciated. Thanks!

  2. Thanks, Larry. I'm going to give that a try. Out of curiosity, do you know exactly what the filter "filters?" I looked around on the web and couldn't find any specific information about this. I found that as long as I entered anything with an @ in it it worked. I thought it would also require some sort of .com/.net, etc. at the end, but it doesn't seem to. For example:

     

    swilkison (this triggers an error)

    swilkison@comcast (this works fine, even though there is no .net at the end)

  3. I've been using a script to check submissions for proper email formatting. It looks like this:

     

    eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)

     

    Note, that I didn't write this script, it was provided by someone else.

     

    It's worked fine for years, but now I'm getting an error message saying the function has been deprecated. I think my host must have installed a new version of PHP, 5.3.2.

     

    That's cool, I just need to figure out what to replace this code with. I've done a little research and it seems there are several ways to approach this, including:

     

    1. just replace "eregi" with "preg_match."

    2. use "filter_var" and "FILTER_VALIDATE_EMAIL" instead.

     

    Any advice as to what would be the best way to update this script would be greatly appreciated.

     

    Thanks!

  4. Here's what I'm trying do.

     

    Let's say my database has 30 entries in it. I want to display the first 15 in one section of my page and the remaining 15 in a different section. So, I figured I would use mysql_affected_rows() to see how many entries were being returned. This works fine, but now I'm stuck on how exactly to write an if/while loop that loops through and prints out only the first half or the second half.

     

    Or should I be going about it completely differently and simply writing a query that only returns the first or second half?

     

    Any advice or direction would be greatly appreciated! Thanks.

  5. OK, so here's the deal. These "dates" are being entered through WordPress. I don't know how familiar any of you are with WordPress. We use a "custom field" to store the date. We use this syntax: "20120425" would be April 25, 2012. It appears that this is stored in the MySQL database as "longtext." We don't have any control over that.

     

    Then I pull that value into the web page and compare it to a variable that establishes "today's date": $todaysdate = date("Ymd"); This allows me to then sort the dates in order.

     

    I then say to display all dates that are greater than or equal to $todaysdate.

     

    So, it's not really the individual dates that are entered into the database that I need to (or even can) deal with.

     

    What I'm hoping I can do is figure out some way that the variable $todaysdate = date("Ymd"); lasts until midnight.

     

    Right now it seems that at 7:00PM $todaysdate thinks it is now the next day.

     

    I hope this makes sense. Thanks again for the help.

  6. Thanks for the input Larry. Unfortunately, it's not really practical in this case to enter in different time zones for each date. What I'd like to figure out is simply how to adjust the current setting. So, if all the dates right now drop off at 7:00PM CST, when I'm viewing them here in Central Time, where and what would I adjust to make them stay on until midnight CST? That would be close enough for my client. Thanks for the help.

  7. I have a client who is a musician. I have set up a database that displays tour dates. This is done in WordPress, but the code is PHP, so I'm hoping someone here can help.

     

    I've coded the page so that only dates that are equal to today or greater show up.

     

    It all works fine, except the problem is a date falls off the page at 7:00PM my time (CST). I want it to stay until midnight.

     

    I believe I am establishing today's date and then comparing it to a date entered in the database and telling the page to display any date that is equal or greater to today's date. Is there something I need to adjust somewhere that determines when the PHP code decides it is now the next day? As I said, it seems to be happening at 7:00PM and I need it to wait until midnight.

     

    Any help would be greatly appreciated! Thanks!

     

    The code looks like this:

     

     

    $todaysdate = date("Ymd");

     

    $args = array(

     

    'meta_query' => array(

    array(

    'key' => 'TheDate',

    'value' => $todaysdate,

    'compare' => '>='

    )

    ),

    'cat' => '1',

    'posts_per_page' => -1,

    'orderby' => 'meta_value_num',

    'meta_key' => 'TheDate',

    'order' => 'ASC'

    );

     

    $the_query = new WP_Query( $args );

  8. I have a client who needs to move their website to another host. They have a forum using vBulletin software. It's been active for many years and is very large.

     

    I'm trying to export the mysql from the database so that I can rebuild the database on the new servers, but whenever I try to export it I just get an empty, blank document. I suspect, but I'm not really sure, that maybe it's so big the current settings won't allow enough time to complete the export. Does this sound possible? If so, how would I fix this? If not, what other things could be causing this.

     

    The phpMyAdmin interface says version 2.8.2.4 and the MySQL says version 5.0.45.

     

    Bottom line, I need to get the database exported, so any suggestions would be very welcome. Thanks much for any help.

  9. Here's what I'm trying to do:

     

    I have a form with a checkbox group containing four checkboxes. The "name" for each checkbox is name="storetype[]". The values for the four checkboxes are: fashion, jewelry, home and other. I am successfully collecting the information fine using this code:

     

    if (!empty($_POST['storetype'])) {

    $storetype = $_POST['storetype'];

    } else {

    $storetype = FALSE;

    $errormessage .= '<p class="error">You forgot to answer what type of store you have!</p>';

    }

     

    What I'm trying to do now is echo the information back into the form in case they forgot to fill out a different area of the form and get an error message saying so. I don't want them to have to recheck these boxes, but have them already checked for them if they checked them the first time.

     

    I'm using this code:

     

     

    <input type="checkbox" name="storetype[]" value="fashion" id="fashion" <?php if (!(strcmp("fashion", "$storetype"))) {echo "checked=\"checked\"";} ?> /><label for="fashion"> Fashion Boutique</label>

     

    But, alas, it's not working. The boxes don't get checked.

     

    Any help or direction as to what I'm doing wrong would be greatly appreciated.

     

    Thanks!

×
×
  • Create New...