robbins Posted December 30, 2006 Share Posted December 30, 2006 i'm inserting this into a phpfusion page, so the dbconnect is done, and dbquery is how fusion does its sql querys... and also the $userdata part is fusions variable for the user, so all of that stuff works... now heres the code, and my problem is below.<?$result = dbquery("select * from site_users where user_id=".$userdata['user_id']); if ($result['js1'] == true) {echo "ERROR: You've Already Done This!";}else {$rr = dbquery('update '.$db_prefix.'users set js1=true where user_id='.$userdata['user_id'].' limit 1;');$rrr = dbquery('update '.$db_prefix.'users set user_points=user_points+3 where user_id='.$userdata['user_id'].' limit 1;');}?>i run it... and it set my user accounts js1 to true... but then, when i ran it again... it still ran whats under else ... even though my accounts js1 is set to true... what is up with that??? Quote Link to comment Share on other sites More sharing options...
Kairu Posted December 30, 2006 Share Posted December 30, 2006 That query will not return "True". It only returns false or a resource. And from that resource, before you do anything with it, you are trying to use it as an array.[code]<?$result = dbquery("select * from site_users where user_id=".$userdata['user_id']);$row = mysql_fetch_array($result); if ($row['Username'] == "js1" ) {echo "ERROR: You've Already Done This!";}else {$rr = dbquery('update '.$db_prefix.'users set js1=true where user_id='.$userdata['user_id'].' limit 1;');$rrr = dbquery('update '.$db_prefix.'users set user_points=user_points+3 where user_id='.$userdata['user_id'].' limit 1;');}?>[/code]I believe this will work. It may not, as I am still new to PHP. Quote Link to comment Share on other sites More sharing options...
ki Posted December 30, 2006 Share Posted December 30, 2006 instead of dbquery user mysql_query 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.