php - SELECT Using Email Addresses -
i using php pdo
trying retrieve records table using email key. when email given directly in sql statement, works fine,
but when sending email in field "$bio_email", not work. email field table type "varchar"
i have tried several options neither 1 works. error system returning in right hand side of sql statement
this code
$bio_email = $applicantinfo->user_email; // email table $sql = "select * tb_files_upload "; $sql .= " email = 'applicant1@live.ca' "; // works fine //$sql .= " email = 'danilo.gonzalez@parkinson.ca' "; // works fine //$sql .= " email = $bio_email "; // not work ... syntax use near '@live.ca' @ line 1 //$sql .= " email = {$bio_email} "; // not work ... syntax use near '@live.ca' @ line 1 //$sql .= " email = '{$bio_email}' "; // not work ... syntax use near ''applicant1@live.ca'' @ line 1 //$sql .= " email = '$bio_email' "; // not work ... syntax use near ''applicant1@live.ca'' @ line 1 $biosketchs = tb_files_upload::find_by_sql($sql);
also in same table have field "datereceived". have records 2.5 years old. please me this.
i try
$sql .= " email = '$bio_email' ";
for datereceived, date_sub month, , year inside.
datereceived >= date_sub(date_sub(curdate(), interval 6 month), interval 2 year)
or let's not stupid , use 18 months directly
$sql.= " , datereceived >= date_sub(curdate(), interval 18 month)";
Comments
Post a Comment