Hi People,

I need to find invalid emails from the database. and display corresponding columns of those emails (name, phone, address etc) with proper pagination.

I have a database with a table named csv_data_table. This table has fields NAME, EMAIL, PHONE, ADDRESS, DESIGNATION.

I have to find invalid emails from the database. I'm using the following code,

$email_array = array(); // define an array to hold all emails

$sql= "select * from csv_data_table";

// Now this $email_array has all emails from the table. I'm using foreach to filter out invalid emails.

$invalid_email_arr= array();

foreach($email_array as $value)
$invalid_email_arr[]= $value;



// $invalid_email_arr is having all invalid emails which I need to display in tabular form... along with its corresponding columns(name, phone, address etc) so.......

$num_invalid_email_arr= count($invalid_email_arr); // count number of array elements.

$sql_invalid_email_id= "SELECT * FROM csv_data_table WHERE EMAIL='" .$invalid_email_arr[$j]. "'";

$sql_invalid_email_id_rslt= mysql_query($sql_invalid_email_id);

<td>echo $sql_invalid_email_id_row['NAME'];</td>
<td>echo $sql_invalid_email_id_row['EMAIL'];</td>
<td>echo $sql_invalid_email_id_row['PHONE'];</td>
<td>echo $sql_invalid_email_id_row['ADDRESS'];</td>
<td>echo $sql_invalid_email_id_row['DESIGNATION'];</td>




That gives me the required data in tabular form. Now issue is the pagination. How do I implement the LIMIT value in such scenario?

Search this forum for "pagination", lots of examples available.

Alright, I need not query each email value now... Got this query which detects invalid emails.

$sql_new= "SELECT * FROM csv_data_table WHERE `EMAIL` NOT REGEXP '^[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]@[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]\.[a-zA-Z]{2,4}$' LIMIT $start, $limit";

$rslt_new= mysql_query($sql_new);