dsp77 Posted March 22, 2010 Share Posted March 22, 2010 i have this code $hasRevista = false; // daca are revista $query2 = "SELECT * FROM performancecriteria WHERE project_id = $project AND year = 2010 AND type = 1;"; $result2 = mysql_query($query2) or die("can not make query ". mysql_error()); $row = @mysql_fetch_row($result2); if( $row[1] != 0 ) { $hasRevista = true; } then i output if( $hasRevista == true ) echo '<input type="button" style="height:1.8em; width:16em;" value="Anexa IIb" onClick="printAnexa2b();"; ></input>'; else echo '<input type="button" style="height:1.8em; width:16em;" value="Anexa IIb" onclick="alert(\'message\')">'; the thing is that i have type = 2 in the db and i want to verify if both or one is zero = false and if both are different from 0 = true. Untill now i just managed to do with type 1 Quote Link to comment Share on other sites More sharing options...
dsp77 Posted March 22, 2010 Author Share Posted March 22, 2010 i solved by doin like this: $hasRevista = false; // daca are revista $query2 = "SELECT * FROM performancecriteria WHERE project_id = $project AND year = 2010 AND type = 1;"; $query3 = "SELECT * FROM performancecriteria WHERE project_id = $project AND year = 2010 AND type = 2;"; $result2 = mysql_query($query2) or die("can not make query ". mysql_error()); $result3 = mysql_query($query3) or die("can not make query ". mysql_error()); $row = @mysql_fetch_row($result2); $row3 = @mysql_fetch_row($result3); if( $row[1] != 0 ) if( $row3[1] != 0 ) { $hasRevista = true; } i'm sure there is a better way... Quote Link to comment Share on other sites More sharing options...
harristweed Posted March 22, 2010 Share Posted March 22, 2010 $query2 = "SELECT * FROM performancecriteria WHERE project_id = $project AND year = 2010 AND ( type = 1 OR type + 2 )"; Quote Link to comment Share on other sites More sharing options...
harristweed Posted March 22, 2010 Share Posted March 22, 2010 Sorry, can't type.... $query2 = "SELECT * FROM performancecriteria WHERE project_id = $project AND year = 2010 AND ( type = 1 OR type = 2 )"; 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.