Gostaria de saber como simplificar esse código... alguém pode ajudar ?
<?php session_start(); header("Content-Type: text/html; charset=ISO-8859-1",true); include "connect.php"; if(isset($_SESSION['numero'])) { //echo $_SESSION['numero'].'<br>'; $numero = $_SESSION['numero']+25; $_SESSION['numero'] = $numero; $numero = $_SESSION['numero']; } else { $_SESSION['numero'] = 0; $numero = $_SESSION['numero']; } $soma_01 = 1+$numero; $soma_02 = 2+$numero; $soma_03 = 3+$numero; $soma_04 = 4+$numero; $soma_05 = 5+$numero; $soma_06 = 6+$numero; $soma_07 = 7+$numero; $soma_08 = 8+$numero; $soma_09 = 9+$numero; $soma_10 = 10+$numero; $soma_11 = 11+$numero; $soma_12 = 12+$numero; $soma_13 = 13+$numero; $soma_14 = 14+$numero; $soma_15 = 15+$numero; $soma_16 = 16+$numero; $soma_17 = 17+$numero; $soma_18 = 18+$numero; $soma_19 = 19+$numero; $soma_20 = 20+$numero; $soma_21 = 21+$numero; $soma_22 = 22+$numero; $soma_23 = 23+$numero; $soma_24 = 24+$numero; $soma_25 = 25+$numero; //echo $soma_25; $query_01 = "select xml from rss where id = '$soma_01'"; $query_02 = "select xml from rss where id = '$soma_02'"; $query_03 = "select xml from rss where id = '$soma_03'"; $query_04 = "select xml from rss where id = '$soma_04'"; $query_05 = "select xml from rss where id = '$soma_05'"; $query_06 = "select xml from rss where id = '$soma_06'"; $query_07 = "select xml from rss where id = '$soma_07'"; $query_08 = "select xml from rss where id = '$soma_08'"; $query_09 = "select xml from rss where id = '$soma_09'"; $query_10 = "select xml from rss where id = '$soma_10'"; $query_11 = "select xml from rss where id = '$soma_11'"; $query_12 = "select xml from rss where id = '$soma_12'"; $query_13 = "select xml from rss where id = '$soma_13'"; $query_14 = "select xml from rss where id = '$soma_14'"; $query_15 = "select xml from rss where id = '$soma_15'"; $query_16 = "select xml from rss where id = '$soma_16'"; $query_17 = "select xml from rss where id = '$soma_17'"; $query_18 = "select xml from rss where id = '$soma_18'"; $query_19 = "select xml from rss where id = '$soma_19'"; $query_20 = "select xml from rss where id = '$soma_20'"; $query_21 = "select xml from rss where id = '$soma_21'"; $query_22 = "select xml from rss where id = '$soma_22'"; $query_23 = "select xml from rss where id = '$soma_23'"; $query_24 = "select xml from rss where id = '$soma_24'"; $query_25 = "select xml from rss where id = '$soma_25'"; $_sql = "SELECT * FROM rss"; $_res = mysql_query($_sql,$_con); $_nr = mysql_num_rows($_res); //echo $_nr; //echo $numero; //echo $soma_25; if( ($soma_01 <= $_nr) xor ($soma_02 <= $_nr) xor ($soma_03 <= $_nr) xor ($soma_04 <= $_nr) xor ($soma_05 <= $_nr) xor ($soma_06 <= $_nr) xor ($soma_07 <= $_nr) xor ($soma_08 <= $_nr) xor ($soma_09 <= $_nr) xor ($soma_10 <= $_nr) xor ($soma_11 <= $_nr) xor ($soma_12 <= $_nr) xor ($soma_13 <= $_nr) xor ($soma_14 <= $_nr) xor ($soma_15 <= $_nr) xor ($soma_16 <= $_nr) xor ($soma_17 <= $_nr) xor ($soma_18 <= $_nr) xor ($soma_19 <= $_nr) xor ($soma_20 <= $_nr) xor ($soma_21 <= $_nr) xor ($soma_22 <= $_nr) xor ($soma_23 <= $_nr) xor ($soma_24 <= $_nr) xor ($soma_25 <= $_nr)) { echo 'codigo'; $query_01 = mysql_query($query_01,$_con); $y = mysql_fetch_array($query_01); $_res = $y["xml"]; echo $_res; if($soma_01 < $_nr){ echo ","; } $query_02 = mysql_query($query_02,$_con); $y = mysql_fetch_array($query_02); $_res = $y["xml"]; echo $_res; if($soma_02 < $_nr){ echo ","; } $query_03 = mysql_query($query_03,$_con); $y = mysql_fetch_array($query_03); $_res = $y["xml"]; echo $_res; if($soma_03 < $_nr){ echo ","; } $query_04 = mysql_query($query_04,$_con); $y = mysql_fetch_array($query_04); $_res = $y["xml"]; echo $_res; if($soma_04 < $_nr){ echo ","; } $query_05 = mysql_query($query_05,$_con); $y = mysql_fetch_array($query_05); $_res = $y["xml"]; echo $_res; if($soma_05 < $_nr){ echo ","; } $query_06 = mysql_query($query_06,$_con); $y = mysql_fetch_array($query_06); $_res = $y["xml"]; echo $_res; if($soma_06 < $_nr){ echo ","; } $query_07 = mysql_query($query_07,$_con); $y = mysql_fetch_array($query_07); $_res = $y["xml"]; echo $_res; if($soma_07 < $_nr){ echo ","; } $query_08 = mysql_query($query_08,$_con); $y = mysql_fetch_array($query_08); $_res = $y["xml"]; echo $_res; if($soma_08 < $_nr){ echo ","; } $query_09 = mysql_query($query_09,$_con); $y = mysql_fetch_array($query_09); $_res = $y["xml"]; echo $_res; if($soma_09 < $_nr){ echo ","; } $query_10 = mysql_query($query_10,$_con); $y = mysql_fetch_array($query_10); $_res = $y["xml"]; echo $_res; if($soma_10 < $_nr){ echo ","; } $query_11 = mysql_query($query_11,$_con); $y = mysql_fetch_array($query_11); $_res = $y["xml"]; echo $_res; if($soma_11 < $_nr){ echo ","; } $query_12 = mysql_query($query_12,$_con); $y = mysql_fetch_array($query_12); $_res = $y["xml"]; echo $_res; if($soma_12 < $_nr){ echo ","; } $query_13 = mysql_query($query_13,$_con); $y = mysql_fetch_array($query_13); $_res = $y["xml"]; echo $_res; if($soma_13 < $_nr){ echo ","; } $query_14 = mysql_query($query_14,$_con); $y = mysql_fetch_array($query_14); $_res = $y["xml"]; echo $_res; if($soma_14 < $_nr){ echo ","; } $query_15 = mysql_query($query_15,$_con); $y = mysql_fetch_array($query_15); $_res = $y["xml"]; echo $_res; if($soma_15 < $_nr){ echo ","; } $query_16 = mysql_query($query_16,$_con); $y = mysql_fetch_array($query_16); $_res = $y["xml"]; echo $_res; if($soma_16 < $_nr){ echo ","; } $query_17 = mysql_query($query_17,$_con); $y = mysql_fetch_array($query_17); $_res = $y["xml"]; echo $_res; if($soma_17 < $_nr){ echo ","; } $query_18 = mysql_query($query_18,$_con); $y = mysql_fetch_array($query_18); $_res = $y["xml"]; echo $_res; if($soma_18 < $_nr){ echo ","; } $query_19 = mysql_query($query_19,$_con); $y = mysql_fetch_array($query_19); $_res = $y["xml"]; echo $_res; if($soma_19 < $_nr){ echo ","; } $query_20 = mysql_query($query_20,$_con); $y = mysql_fetch_array($query_20); $_res = $y["xml"]; echo $_res; if($soma_20 < $_nr){ echo ","; } $query_21 = mysql_query($query_21,$_con); $y = mysql_fetch_array($query_21); $_res = $y["xml"]; echo $_res; if($soma_21 < $_nr){ echo ","; } $query_22 = mysql_query($query_22,$_con); $y = mysql_fetch_array($query_22); $_res = $y["xml"]; echo $_res; if($soma_22 < $_nr){ echo ","; } $query_23 = mysql_query($query_23,$_con); $y = mysql_fetch_array($query_23); $_res = $y["xml"]; echo $_res; if($soma_23 < $_nr){ echo ","; } $query_24 = mysql_query($query_24,$_con); $y = mysql_fetch_array($query_24); $_res = $y["xml"]; echo $_res; if($soma_24 < $_nr){ echo ","; } $query_25 = mysql_query($query_25,$_con); $y = mysql_fetch_array($query_25); $_res = $y["xml"]; echo $_res; echo "]}}"; } // PARA PARAR O REFLESH else { echo 'codigo_stop'; $query_01 = mysql_query($query_01,$_con); $y = mysql_fetch_array($query_01); $_res = $y["xml"]; echo $_res; if($soma_01 < $_nr){ echo ","; } $query_02 = mysql_query($query_02,$_con); $y = mysql_fetch_array($query_02); $_res = $y["xml"]; echo $_res; if($soma_02 < $_nr){ echo ","; } $query_03 = mysql_query($query_03,$_con); $y = mysql_fetch_array($query_03); $_res = $y["xml"]; echo $_res; if($soma_03 < $_nr){ echo ","; } $query_04 = mysql_query($query_04,$_con); $y = mysql_fetch_array($query_04); $_res = $y["xml"]; echo $_res; if($soma_04 < $_nr){ echo ","; } $query_05 = mysql_query($query_05,$_con); $y = mysql_fetch_array($query_05); $_res = $y["xml"]; echo $_res; if($soma_05 < $_nr){ echo ","; } $query_06 = mysql_query($query_06,$_con); $y = mysql_fetch_array($query_06); $_res = $y["xml"]; echo $_res; if($soma_06 < $_nr){ echo ","; } $query_07 = mysql_query($query_07,$_con); $y = mysql_fetch_array($query_07); $_res = $y["xml"]; echo $_res; if($soma_07 < $_nr){ echo ","; } $query_08 = mysql_query($query_08,$_con); $y = mysql_fetch_array($query_08); $_res = $y["xml"]; echo $_res; if($soma_08 < $_nr){ echo ","; } $query_09 = mysql_query($query_09,$_con); $y = mysql_fetch_array($query_09); $_res = $y["xml"]; echo $_res; if($soma_09 < $_nr){ echo ","; } $query_10 = mysql_query($query_10,$_con); $y = mysql_fetch_array($query_10); $_res = $y["xml"]; echo $_res; if($soma_10 < $_nr){ echo ","; } $query_11 = mysql_query($query_11,$_con); $y = mysql_fetch_array($query_11); $_res = $y["xml"]; echo $_res; if($soma_11 < $_nr){ echo ","; } $query_12 = mysql_query($query_12,$_con); $y = mysql_fetch_array($query_12); $_res = $y["xml"]; echo $_res; if($soma_12 < $_nr){ echo ","; } $query_13 = mysql_query($query_13,$_con); $y = mysql_fetch_array($query_13); $_res = $y["xml"]; echo $_res; if($soma_13 < $_nr){ echo ","; } $query_14 = mysql_query($query_14,$_con); $y = mysql_fetch_array($query_14); $_res = $y["xml"]; echo $_res; if($soma_14 < $_nr){ echo ","; } $query_15 = mysql_query($query_15,$_con); $y = mysql_fetch_array($query_15); $_res = $y["xml"]; echo $_res; if($soma_15 < $_nr){ echo ","; } $query_16 = mysql_query($query_16,$_con); $y = mysql_fetch_array($query_16); $_res = $y["xml"]; echo $_res; if($soma_16 < $_nr){ echo ","; } $query_17 = mysql_query($query_17,$_con); $y = mysql_fetch_array($query_17); $_res = $y["xml"]; echo $_res; if($soma_17 < $_nr){ echo ","; } $query_18 = mysql_query($query_18,$_con); $y = mysql_fetch_array($query_18); $_res = $y["xml"]; echo $_res; if($soma_18 < $_nr){ echo ","; } $query_19 = mysql_query($query_19,$_con); $y = mysql_fetch_array($query_19); $_res = $y["xml"]; echo $_res; if($soma_19 < $_nr){ echo ","; } $query_20 = mysql_query($query_20,$_con); $y = mysql_fetch_array($query_20); $_res = $y["xml"]; echo $_res; if($soma_20 < $_nr){ echo ","; } $query_21 = mysql_query($query_21,$_con); $y = mysql_fetch_array($query_21); $_res = $y["xml"]; echo $_res; if($soma_21 < $_nr){ echo ","; } $query_22 = mysql_query($query_22,$_con); $y = mysql_fetch_array($query_22); $_res = $y["xml"]; echo $_res; if($soma_22 < $_nr){ echo ","; } $query_23 = mysql_query($query_23,$_con); $y = mysql_fetch_array($query_23); $_res = $y["xml"]; echo $_res; if($soma_23 < $_nr){ echo ","; } $query_24 = mysql_query($query_24,$_con); $y = mysql_fetch_array($query_24); $_res = $y["xml"]; echo $_res; if($soma_24 < $_nr){ echo ","; } $query_25 = mysql_query($query_25,$_con); $y = mysql_fetch_array($query_25); $_res = $y["xml"]; echo $_res; echo "fim"; } mysql_close($_con); ?>
Thank you
