On 28-Feb-2003 Stitchin wrote: > > This is so simple and basic, I must be missing something.... > > I have php code for displaying my embroidery designs on the web page. It's > going through the mySql database and the query to pull up all the designs > for a > chosen category works fine. I have two fields in > my database called "applique" and "puffyfoam" both are set up as tinyint(1) > because all I'm storing there is a zero for no and a 1 for yes. > > But for the screen output I don't want these codes to show, I'd like a > comment to show up. So I set up this "if" statement to place the proper > statement in a variable to be used in my echo statement (if both answers are > no, I don't want to print oops, I just put that there to see where stuff was > happening)... > > > if($applique == 1 and $puffyfoam == 0) > { > $message1 = "Digitized for APPLIQUE"; > } > elseif($applique == 0 and $puffyfoam == 1) > { > $message1 = "Digitized for PUFFY FOAM"; > } > elseif($applique == 1 and $puffyfoam == 1) > { > $message1 = "Digitized for APPLIQUE and PUFFY FOAM"; > } > else > { > $message1 = "oops"; > } > > I have three records in this category that I've set up with answers to the > two fields as 1,1 0,1 and 1,0 to see what message would show .... none > should show up as "oops" since none are 0,0. I've also put the "applique" > raw field data in my echo to see if it is pulling up the right answer as > well ... > > The field is showing the correct field info for applique, they're showing up > as 1,0,1 BUT every one of the designs are showing the message "oops". What > am I doing wrong??? > > TIA > Renee :) > >
$vals=array( 'APPLIQUE', 'PUFFY FOAM', 'APPLIQUE and PUFFY FOAM' ); $k=$applique + ($puffyfoam << 1); $message1='Digitized for ' .$vals[$k]; Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php