Re: Question regarding how-to stop the form inputting empty data at end of the form that is empty due to a carriage return

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



В сообщении от Среда 12 Январь 2005 04:52 Mike Millner написал(a):
> 243 Query       INSERT INTO tape_tracking_test
> (media_id,retention,out_date,return_date,box_id) values
> ('','7WK=%s','2005-01-11','2005-3-01','006455C5092800')
>
>
> How can I get PHP to ignore that line that has empty data in the media_id
> field?

Hi.

May be check $MediaID_ar[$i], and if it empty just not write media_id?
f.e.

$query = "INSERT INTO tape_tracking_test (";
if ( ! empty( $MediaID_ar[$i] ) ){
    $query .= "media_id, ";
}
$query.= "retention,out_date,return_date,box_id) values (";

if ( ! empty( $MediaID_ar[$i] ) ){
    $query .= "'".$MediaID_ar[$i]."',";
}

$query.= '". $_POST['Retention'] ."=%s','". $_POST['OutDate'] 
."','". $_POST['calendarDate'] ."','". $_POST['BoxID'] ."')";

mysql_query( $query );
bla bla bla

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux