[Scottish] php and my sql

Paxton, Darren scottish at mailman.lug.org.uk
Tue Feb 11 16:40:02 2003


Looks vaugely familiar!

-----Original Message-----
From: Ismail Murat Dilek [mailto:olive@zoom.co.uk] 
Sent: 11 February 2003 16:35
To: scottish@mailman.lug.org.uk
Subject: [Scottish] php and my sql


Hi,
I ve created a mysql database. Basically user fills  the form then  hits
submit button and  all data posted to mysql database.This part works fine.
Next time user return the page enters their email address and hits submit
button. my php script check if email address exist in our database if exist
takes user to download page, if not exist takes them to registration page.
Some strange reason this comparasing is not working properly. it works for
some email addresses, e.g. my email address olive@zoom.co.uk is registered
in mysql database so script should take to download page but it is taking me
registration page instead any ideas <?
//Author: Ismail Murat Dilek

require("conn.php");
/// ========================================================
// following part read values of entered details and prepares them for mysql
data input format

$email = $HTTP_POST_VARS["email"];
///========================================================


$query ="Select email from details"; // selects email field from details
table $result = mysql_query($query); //executes sql select query $num_result
= mysql_num_rows($result);
/* searches database for email, if email dosent exist writes details to
database,then redirects user to download page */ for ($i=0; $i<$num_result;
$i++) {
     $row= mysql_fetch_array($result);
     $eml = stripslashes($row[email]);
     $email = trim($email);
     $eml = trim($eml);
     $eq = strcmp($email,$eml);
     if ($eq != 0)
     {
     header("Location:register.php");

     }
     else
     {
     header("Location:download.php");
     }



}//end for

?>




_______________________________________________
Scottish mailing list
Scottish@mailman.lug.org.uk
http://mailman.lug.org.uk/mailman/listinfo/scottish

This e-mail and any attachments may be confidential or legally privileged.
If you received this message in error or are not the intended recipient, you
should destroy the e-mail message and any attachments or copies, and you are
prohibited from retaining, distributing, disclosing or using any information
contained herein.  Please inform us of the erroneous delivery by return
e-mail.  Thank you for your co-operation. 
Mercer Human Resource Consulting Limited is regulated by the Financial
Services Authority and is a member of the General Insurance Standards
Council. Registered in England No. 984275. Registered Office: Telford House,
14 Tothill Street, London SW1H 9NB