Author Topic: Wrong date (1969-12-31 18:00:00) in the new image field  (Read 4458 times)

0 Members and 1 Guest are viewing this topic.

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Wrong date (1969-12-31 18:00:00) in the new image field
« on: January 17, 2010, 04:11:37 PM »
Hey guys,

I have a problem:

I added a new field to my images table via admin/images.php. (Not an additional field)

show_date_input_row($lang['field_image_date2'].$lang['date_format'], "image_date2"$images['image_date2'], $textinput_size);

Till now everything is doing fine, but the problem is when it is empty (0), het shows this date: 1969-12-31 18:00:00 instead of nothing (Empty).

PS: Only by editing an image. During adding an new image, he shows an empty field.

Does anyone knows how to solve this issue?

Any help will be appreciated.

Cruxy
« Last Edit: January 17, 2010, 09:16:30 PM by cruxy »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Wrong date (1969-12-31 18:00:00) in the new image field
« Reply #1 on: January 17, 2010, 08:13:21 PM »
What is the mysql query string you've added that saves the value in the database?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Wrong date (1969-12-31 18:00:00) in the new image field
« Reply #2 on: January 17, 2010, 09:15:56 PM »
$sql "INSERT INTO ".IMAGES_TABLE."
                (cat_id, user_id, image_name, image_description, image_keywords, image_date, image_active, image_media_file, image_thumb_file, image_download_url, image_allow_comments, image_date2"
.$additional_field_sql.")
                VALUES
                (
$cat_id$user_id, '$image_name', '$image_description', '$image_keywords', $current_time$image_active, '$new_name', '$new_thumb_name', '$image_download_url', $image_allow_comments$image_date2".$additional_value_sql, .")";
        
$result $site_db->query($sql);
        
$image_id $site_db->get_insert_id();

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Wrong date (1969-12-31 18:00:00) in the new image field
« Reply #3 on: January 17, 2010, 10:03:47 PM »
hmmmm, ok, I think you also have something similar to this:
  $image_date2 = (trim($HTTP_POST_VARS['image_date2']) != "") ? "UNIX_TIMESTAMP('".trim($HTTP_POST_VARS['image_date2'])."')" time();


if so, then replace it with:
  $image_date2 = empty(trim($HTTP_POST_VARS['image_date2'])) ? "0" "UNIX_TIMESTAMP('".trim($HTTP_POST_VARS['image_date2'])."')";
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Wrong date (1969-12-31 18:00:00) in the new image field
« Reply #4 on: January 17, 2010, 10:23:19 PM »
I got a parse error:

Parse errorsyntax errorunexpected T_STRINGexpecting T_VARIABLE or '$' in /hsphere/local/home

Any idea?