Short Code for a Simple Script

From: Date: Fri, 20 Oct 2000 21:20:03 +0000
Subject: Short Code for a Simple Script
Groups: php.general 
Request: Send a blank email to php-general+get-21487@lists.php.net to get a copy of this message
Okay now that I am starting to get the hang of writing PHP code I want to try and learn all the short cuts and small code ideas from you people. I can figure out a way to do the following but I know there has to be a much simpler way then what I am thinking about. Here is what I want to do. I have a variable $x I have a simple table on a DB with two columns ID Value 1 A 2 B 3 C Now I want to run a simple search on the value in the table and the variable $x. if $x=A then set $y to the ID 1 if $x=B then set $y to the ID 2 etc. Anyone have some quick simple ways to do this that I can learn from? Thanks Phillip S. Baker phillip@wordsandimages.com Words & Images 1535 Seabright Avenue, Suite 100, Santa Cruz, CA 95062 Direct Line (831) 420-2641 / Fax (831) 458-0808

« previous php.general (#21487) next »