Our registrars receive a list of student attendees which they either insert in the database as new, or update as existing students. Currently, they must do this with each individual email address. It's slow.
We'd like to let them copy and paste a comma separated list into a textarea, and click a button to search the database which will echo out the list of those previously registered.
I'm exploding the Post textarea into array $students, trimming it, etc. and the results print_r just fine. But extracting from the db and echoing the list of registered users is breaking down. This is the latest errant permutation, but I've been through 31 flavors 'cause I just don't know how to write this.
In the head code:
$students = rtrim($_POST['CSValues'],','); for readability, I removed the sanitation string
$students = explode(',', $students);
foreach($students as $key=>$value) {
mysql_select_db($database_xxxxxxx, $xxxxxxx);
$query_rsFindStudents = "SELECT Students.Stud_email_addr FROM Students
WHERE Students.Stud_email_addr = '".$value."'";
$rsFindStudents = mysql_query($query_rsFindStudents, $xxxxxxx) or die(mysql_error());
$row_rsFindStudents = mysql_fetch_assoc($rsFindStudents);
$totalRows_rsFindStudents = mysql_num_rows($rsFindStudents);
in the body
do {
echo $row_rsFindStudents['Stud_email_addr'], '<br />';
} while ($row_rsFindStudents = mysql_fetch_assoc($rsFindStudents));
But it either isn't finding, or echoing, any of the registered email addresses. TIA. Any pointers you can give me are deeply appreciated.
var_dump($row_rsFindStudents)to see what you're REALLY getting back from the database?