Re: Check for duplicates

From: Date: Sat, 02 Dec 2000 16:27:54 +0000
Subject: Re: Check for duplicates
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-28371@lists.php.net to get a copy of this message
Hi Murph: > You know, there's a funny bit. I can't seem to get a select statement to > work with any sort of function with parentheses in it. > > Like, if I did: > > $sql = "SELECT upper(email) FROM tablename"; > $result = mysql_query($sql); This creates a fine result containing a column filled with rows of upper case email addresses. The column, though, will be named "upper(email)" and you'll have to refer to that column name as such in your PHP code. So, it's easier to add an "as" clause: $sql = "SELECT upper(email) AS E FROM tablename"; so you can refer to the column as "E" > I get an error at worst, unexpected results at best. I have yet to see the > count() function work. Has anyone ever seen that happen? Uh, what do you mean it doesn't work? Does the query crash? Or are you unable to display the results of the count() column in your PHP? If so, it's the same reason, you're calling it by the wrong name in your subsequent PHP code. > I admit I'm not a wiz but, jeez, I'm not a moron (I think) either. Do you > suppose that there's something about the way either PHP or MySQL is > installed that screwing me up? Uh, you might want to reevaluate your first sentence. :) No, you're not a moron, just someone who's learning, like us all. Enjoy, --Dan -- PHP scripts that make your job easier http://www.analysisandsolutions.com/code/ SQL Solution | Layout Solution | Form Solution T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Ave, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

« previous php.general (#28371) next »