Weird things with if statement or "how to lose your min

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

bdlang
Forum Contributor
Posts: 395
Joined: Tue May 16, 2006 8:46 pm
Location: Ventura, CA US

Post by bdlang »

Milan wrote:now when i compare that with my code, i am just depressed 8O
Feh. Don't feel bad about it at all, as the Perl motto attests: TMTOWTDI (there's more than one way to do it) and somebody else will always come up with a quicker, better method. You'll get there, it takes time. Your way was fine, I just thought a quick example of a (potentially) more efficient method was warranted.
Milan
Forum Commoner
Posts: 97
Joined: Wed May 17, 2006 6:08 pm

Post by Milan »

I guess you are right,

I just want to say thanks for all the help.
Now it writes in the table but it writes "5001000"

this is the code:

Code: Select all

$sess = $_GET['session'];
mysql_select_db($database_pickageek, $pickageek);
$query3= 'UPDATE `awapr` SET `pricemin` = ';
switch($row_Recordset2['ptype']) {
    case 'unkn':
        $query3.= 1;
        break;
    case 'smlb':
        $query3.= 100;
        break;
    case 'medb':
        $query3.= 500;
    case 'bigb':
        $query3.= 1000;
        break;
    default:
        $query3.= 1;
}
$query3.= " WHERE `session` = '{$sess}'";
mysql_query($query3) or die(mysql_error());
bdlang
Forum Contributor
Posts: 395
Joined: Tue May 16, 2006 8:46 pm
Location: Ventura, CA US

Post by bdlang »

Yeah, that was my bad. I forgot a 'break' after the case 'medb': statement. If you look at my original post, I edited the code.
Milan
Forum Commoner
Posts: 97
Joined: Wed May 17, 2006 6:08 pm

Post by Milan »

LOL !

i should get some sleep, i was looking at it for like an hour.
Post Reply