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 Link to comment https://forums.phpfreaks.com/topic/196099-php-mysql-verify-two-rows/ 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... Link to comment https://forums.phpfreaks.com/topic/196099-php-mysql-verify-two-rows/#findComment-1029898 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 )"; Link to comment https://forums.phpfreaks.com/topic/196099-php-mysql-verify-two-rows/#findComment-1029901 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 )"; Link to comment https://forums.phpfreaks.com/topic/196099-php-mysql-verify-two-rows/#findComment-1029903 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.