Re: problem - query inside a function

From: Date: Thu, 16 Oct 2003 14:44:24 +0000
Subject: Re: problem - query inside a function
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-31078@lists.php.net to get a copy of this message
My Comment bellow: On Wednesday 15 October 2003 14:38, Kirk Babb wrote: > Hi, > I'm having trouble with a query inside a function. I thought I'd written > this so that the function would fail if email and zipcode supplied were not > in the same row (trying to use those two things to identify the user), but > I don't think that is what is happening because I can enter the wrong > zipcode and it will return data based on the email. Any suggestions or > corrections? Thanks! > -Kirk > > [code snippet] > function getEditData($email,$zipcode) { > $sql = "SELECT * FROM contact_info WHERE zipcode='$zipcode' AND > email=\"{$email}\""; Change by $sql = "SELECT * FROM contact_info WHERE zipcode='{$zipcode}' AND email='{$email}'"; > $query = mysql_query($sql); > if (mysql_affected_rows()=="0") { > $this->sendResult("Fail","We do not have the given email and zipcode > on file. Please go to the menu and start again."); > } > [end snippet]

« previous php.db (#31078) next »