----- Original Message ----- From: Pete Because you have filled the field with >ENCODE('$email', >'########') even when $email is ''.
The default condition would be if you had used the query > $sql = "INSERT > INTO familyhistory > VALUES ('$msg_id', '$family', '$who', '$message')"; and not passed a value into the email field. I have never used ENCODE and DECODE, but I assume that an empty string is not acceptable to it - have you tried using this? SELECT IF(email='', '', DECODE('$email', '########')) ======================================= Hi Pete, I read the email field first. If no email present, ignore sending the whole message routine. $sql = "SELECT email FROM familyhistory WHERE logged_id='$msg_id'"; $result = mysql_query($sql) or die("Select :Check For Email: error"); $email = mysql_result($result, 0) or die("Result :Check For Email: error"); if ($email != 'no') { $sql = "SELECT DECODE(email, '$salt') AS email FROM familyhistory WHERE logged_id='$msg_id'"; // send message stuff here I haven't used an IF statement in a SELECT yet, so I may be able to use that. The program is working, but I'm trying to rewrite it better in the process of learning. Tried encode and decode with an empty string to see what it does (just returns an empty string and doesn't cause an error) though I think this method might be frowned on. Regards, Bob E. For anyone learning mysql like myself:- <?php // short test prog for encode/decode require ($_SERVER['DOCUMENT_ROOT'].'/cgi-bin/opendb.php'); // $salt could be contained somewhere else or in the above for extra security $salt = "qp3914yspk"; $sql = "INSERT INTO test (id, email) VALUES (NOW(), ENCODE('[EMAIL PROTECTED]', '$salt'))"; mysql_query($sql) or die("insert error"); $sql = "SELECT DECODE(email, '$salt') AS email FROM test ORDER BY id DESC LIMIT 1"; $result = mysql_query($sql) or die("select error"); $row = mysql_fetch_array($result) or die("fetch error"); echo $row['email']; ?> ------------------------ Yahoo! Groups Sponsor --------------------~--> Something is new at Yahoo! Groups. Check out the enhanced email design. http://us.click.yahoo.com/SISQkA/gOaOAA/yQLSAA/HKFolB/TM --------------------------------------------------------------------~-> Community email addresses: Post message: php-list@yahoogroups.com Subscribe: [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] List owner: [EMAIL PROTECTED] Shortcut URL to this page: http://groups.yahoo.com/group/php-list Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-list/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/