omesa Posted October 26, 2006 Share Posted October 26, 2006 Hello,I had posted earlier on a system am working on I got stuck earlier on but I managed to correct the error, now am stuck again.I want to insert into my database the value "Active" if the points are less than 10, otherwise update the database with "Pending" value if the points are greater than 10, as in; MPoints MStatus9 Active10 Active11 Pending12 PendingHere's the code am currently using, it inserts into two rows, where the results are something likeMPoints MStatus90 Active100 Active11 0 Active[code]$upoints = mysql_query("update members set MPoints = MPoints+1"); $result2 = mysql_query("SELECT mpoints,mstatus FROM members WHERE id = '$id'"); if (mysql_num_rows($result2) <= 10) { # not found $result = mysql_query("INSERT INTO members (mstatus) VALUES ('Active')"); } else { $result = mysql_query("UPDATE members SET mstatus = 'Pending' WHERE id = '$id'"); }[/code]How do I achieve this:MPoints MStatus9 Active10 Active11 Pending12 Pendingany help would be greatly appreciated.regardsclement Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.