4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: Sun Zaza on January 17, 2010, 04:11:37 PM

Title: Wrong date (1969-12-31 18:00:00) in the new image field
Post by: Sun Zaza 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
Title: Re: Wrong date (1969-12-31 18:00:00) in the new image field
Post by: V@no on January 17, 2010, 08:13:21 PM
What is the mysql query string you've added that saves the value in the database?
Title: Re: Wrong date (1969-12-31 18:00:00) in the new image field
Post by: Sun Zaza 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();
Title: Re: Wrong date (1969-12-31 18:00:00) in the new image field
Post by: V@no 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'])."')";
Title: Re: Wrong date (1969-12-31 18:00:00) in the new image field
Post by: Sun Zaza on January 17, 2010, 10:23:19 PM
I got a parse error:

Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in /hsphere/local/home

Any idea?