I'll try to explain what I want to do. Basically, some emails in my database have more than 100 characters in them and it crashes my newsletter script. How can I find those emails in my database? table 'users' field 'email'.
You need to check the length of the email. $sql = "SELECT email FROM users;"; $result = mysql_query($sql) or die(mysql_error()); while ($line = mysql_fetch_array($result)){ if (strlen($line[0]) < 100) /* send email */ } mysql_close($dbh); PHP: Cheers
you can use the mysql CHAR_LENGTH function example: SELECT email FROM `tablename` WHERE CHAR_LENGTH( `email` ) < 100 This way you get only the emails with emails shorter than 100 chars/
Got another question. How to find emails that have some kind of special characters in them that could be crashing my script?