Here, for example, the code:
if ( preg_match("/^все/", $pere) ) { $q = "SELECT `opisanie` FROM `daba` where table='все' limit 0,2"; $r = mysql_query("$q;") or die("Что-то не так."); while ($r = mysql_fetch_object($re)) print_r($r->opisanie); } if ( $a == $b ) { $q = "SELECT `opisanie` FROM `daba` where table='все' limit 0,2"; $r = mysql_query("$q;") or die("Что-то не так."); while ($r = mysql_fetch_object($re)) print_r($r->opisanie); } Option:
if ( preg_math("/^все/, $pere) && $a == $b ) And option:
if ( ( preg_match("/^все/", $pere) ) || ( $a == $b ) ) { $sql = "SELECT `opisanie` FROM `daba` where `table`='все' limit 0,2;"; $res = mysql_query($sql) or die("Что-то не так."); while ( $row = mysql_fetch_object($res) ) echo $row->opisanie; } Does not fit.
How to avoid repeating code execution?
UPD : the problem is settled, redid the code ...
opisanieFROMdabawheretable= 'all' limit 0,2;"; $ res = mysql_query ($ sql) or die ("Something is wrong."); while ($ row = mysql_fetch_object ($ res)) echo $ row-> opisanie; } </ code> </ pre> - ReinRaus