Jump to content

Help please - UPDATE... SET col_name = ... IF something


Tom Read

Recommended Posts

Hi.

 

I'm doing a project at college, making a snooker league website.

 

I have a form that has Team, Player and High Break. When submitted, they're stored in a database. This also updates the 'Player Stats' table.

 

What I want to do is for the High Break column in the Player Stats table to update if the high break entered is greater than the value in the table already.

 

For instance, if it says: Tom Read | 43, and in the form I type 36, I want it to remain as 43. If however a break for Tom Read added is 70, I want it to replace the 43. I can't quite get it right though!

 

I want to say something along the lines of:

 

mysql_query ("UPDATE player_table SET High_Break = $high_break IF $high_break > col_value WHERE Player_Name = '$player_name'");

 

Help would be appreciated, thanks :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.