Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2001032

[PHP] PHP - MySQL special character -> mysql problem? From: Alain (alainygr <email protected>)
Date: 03/19/01

Hello,
I am wrining a script that insert students in a database: name, email,....
the data retrive (from text-file) and storing (into database) works fine,
but when I want to check if a student is already in the database, I look for
the email address, and

when I use:
  $check_email = mysql_query("SELECT student_id FROM pdc_student WHERE
student_email=\"".$student_email."\"", $con);
  $number = mysql_numrows($check_email);
  if ($number == 0)
  { .......

OR
  $check_email = mysql_query("SELECT student_id from pdc_student where 1 and
student_email like \"$student_email\"", $con);
  $number = mysql_numrows($check_email);
  if ($number == 0)
  { ........

it works fine EXCEPT if the email address contains "_"
for example, if I try to add a student with email: name_test <email protected>,
it won't be able to find if the email exists already in the db, it will just
add that student even if the email exists already.

And this "_" is allowed for email address... :(

Anybody encounters that problem and could help me to solve it?
Thanks,

-Alain-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>