Jump to content

[SOLVED] How could I do this? Lot's of if statements.


thewhat

Recommended Posts

$userid = ($data['user_id']);

 

if ($userdata['attacking_wars'] == 0) (

 

$dbquery5 = "UPDATE ".$db_prefix."users SET attack_1= '$userid' WHERE user_id='".$data['user_id']."'" ) ;

 

if ($userdata['attacking_wars'] == 1) (

 

$dbquery6 = "UPDATE ".$db_prefix."users SET attack_2= '$userid' WHERE user_id='".$data['user_id']."'" ) ;

 

if ($userdata['attacking_wars'] == 2) (

 

$dbquery7 = "UPDATE ".$db_prefix."users SET attack_3= '$userid' WHERE user_id='".$data['user_id']."'" ) ;

 

I'm doing something wrong because it never updates. I just need it to properly connect. :\

Change your lines from

 

if ($userdata['attacking_wars'] == 0) (

 

$dbquery5 = "UPDATE ".$db_prefix."users SET attack_1= '$userid' WHERE user_id='".$data['user_id']."'" ) ;

 

to

 

if ($userdata['attacking_wars'] == 0) {

 

$dbquery5 = "UPDATE $db_prefix users SET attack_1= '$userid' WHERE user_id='".$data['user_id']."'";

}

 

What is the tablename, like prefixusers?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.