Jump to content
  • 0

Прошу помочь с кодом php (для знающего легко)


cs-monitorer
 Share

Question

Есть код:


<?php
include('header.php');
?>
<style>
#pagination, #price{
font-size: 14px;
padding: 20px;
}
#pagination a, #price a{
font-size: 14px;
color: blue;
font-family: serif;
padding: 5px;
text-transform: lowercase;
}
#price a{
border: 2px red solid;
}
#price{
text-align:center;
}
</style>
<center><div class="search_form">
<span>ПОИСК НОМЕРОВ</span>
<form action="http://vipnomera.com.ua/search_engine.php" method="get">

<?php
$onblur = "- Вы хотите купить красивый номер? - Мы вам поможем это сделать!";
?>
<input onblur="if (this.value=="") this.value='<?php echo $onblur; ?>'" onfocus="if (this.value=='<?php echo $onblur; ?>') this.value=""" size="110" type="text" name="search_word" value='<?php echo $onblur; ?>'>
<input id="poisk-top-input" type="submit" value="">

</form>
<small>Красивые номера Мтс, Золотые номера Мтс, Золотые номера Киевстар, Красивые номера Лайф, Красивые мобильные номера</small>
</div></center>
</br> <center><img src="images/logo22.png"/ width="850"></center>
<table cellspacing="0" style="margin-bottom:70px; margin-top:20px;">
<tr>
<td><div id="mtc">
<a href="numbers.php?mtc=all"><img style='position:absolute;' src='css/img/mtcLogo.png'></a>
<ul style="margin-left:170px;padding-top:40px;">
<li><a href="numbers.php?operator=050"><FONT SIZE=6 ><b> (050)</b></FONT></b></a></li>
<li><a href="numbers.php?operator=066"><FONT SIZE=6 ><b> (066)</b></FONT></b></a></li>
<li><a href="numbers.php?operator=099"><FONT SIZE=6 ><b> (099)</b></FONT></b></a></li>
<li><a href="numbers.php?operator=095"><FONT SIZE=6 ><b> (095)</b></FONT></b></a></li>
</ul>
</div></td>
<td><div id="kvstar">
<a href="numbers.php?kvstar=all"><img style='position:absolute;' src='css/img/kvstarLogo.png'></a>
<a href="numbers.php?srchPars=true"><img style="position:absolute;top:637px;" src="images/kvstar.png"></a>
<ul style="margin-left:170px;padding-top:40px;">
<li><a href="numbers.php?kvstar=all"><FONT SIZE=6 ><b> (067)</b></FONT></a></li>
<li><a href="numbers.php?kvstar=all"><FONT SIZE=6 ><b> (097)</b></FONT></a></li>
<li><a href="numbers.php?kvstar=all"><FONT SIZE=6 ><b> (098)</b></FONT></a></li>
<li><a href="numbers.php?kvstar=all"><FONT SIZE=6 ><b> (096)</b></FONT></a></li>
</ul>
</div></td>
<td><div id="life">
<a href="numbers.php?life=all"><img style='position:absolute;' src='css/img/lifeLogo.png'></a>
<ul style="margin-left:180px;padding-top:40px;">
<li><a href="numbers.php?operator=063"><FONT SIZE=6 ><b> (063)</b></FONT></a></li>
<li><a href="numbers.php?operator=093"><FONT SIZE=6 ><b> (093)</b></FONT></a></li>
</ul>
</div></td>
</tr>
</table>
<div style="margin-top: 20px;pwidth:100%;border-width: 4px; border-style: double; border-color: black;">
<?php
if ($_GET['srchPars'] ) {

$srchPars = ($_GET['srchPars'] == 'true' ? 'true' : 'false') ;

if ($_GET["pag"])
$page = (int) $_GET["pag"];
else
$page = 1;
$per_page = 250;
$q = "SELECT count(*) FROM pare_numbers where category = '" . $srchPars . "'";
$res = mysql_query($q);
$row = mysql_fetch_row($res);
$total_rows = $row[0];
$num_pages = ceil($total_rows / $per_page);
$offset = ($page - 1) * $per_page;
/* print "<table border=0 width=\"150\" align=\"right\">
<tr><td >";
if ($page > 1)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=1&srchPars=" . $srchPars . "\"><b>Весь список</b></a>";
else
print "<b>Весь список</b>";
print "</td><td >";
if ($page > 1)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=" . ($page - 1) . "&srchPars=" . $srchPars . "\"></a>";
else
print "";
print "</td><td align=\"center\" >" . "<form name=\"PgForm\" method='GET' action='" . basename($_SERVER["PHP_SELF"]) . "'><input name=srchPars type=\"hidden\" value=\"" . $srchPars . "\"><select onchange=\"document.PgForm.submit();\" type=text name=pag>
";
for ($i = 1; $i <= $num_pages; $i++) {
echo "<option";
if ($page == $i)
echo " selected"; echo " value=$i>$i</option>";
}
echo "</select></form></td><td align=\"right\" >";
if (($page + 1) <= $num_pages)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=" . ($page + 1) . "&srchPars=" . $srchPars . "\"></a>";
else
print "";
print "</td><td >";
if ($page < $num_pages)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=$num_pages&srchPars=" . $srchPars . "\"></a>";
else
print "";
print "</td></tr></table><br><br>";*/

$html = '<div id="pagination" style="float:right;">Перейти на страницу: ';
for ($i = 1; $i <= $num_pages; $i++) {
$html .= "<a href=\"".basename($_SERVER["PHP_SELF"])."?srchPars=true&pag=".$i."\">".$i."</a>";
}


$html .= '</div><div style="clear:both;"></div>';

$html .= '<div id="price"><b><font color="#0000ff">ВОСПОЛЬЗУЙТЕСЬ УДОБНОЙ СОРТИРОВКОЙ НОМЕРОВ ПО ЦЕНЕ:</font></b>
<a href="'.basename($_SERVER["PHP_SELF"])."?srchPars=true&pag=".$page.'&sort=up">по возрастанию</a>
<a href="'.basename($_SERVER["PHP_SELF"])."?srchPars=true&pag=".$page.'&sort=down">по убыванию</a>
</div>';
echo $html;

if( isset($_GET['sort']) ){

if( $_GET['sort'] == 'up' ){
$order = 'order by price DESC';
}elseif( $_GET['sort'] == 'down' ){
$order = 'order by price';
}else{
$order = 'order by in_group';
}
}else{
$order = 'order by in_group';
}

$sql = mysql_query("SELECT * FROM pare_numbers where category = '" . $srchPars . "' ".$order." LIMIT $offset, $per_page");
if (mysql_num_rows($sql)) {
$prevInGr = -1;
echo "<form method=\"post\">
<table style='width:100%;margin: 20px;padding:10px;' cellspacing='18'>";
while ($record = mysql_fetch_array($sql)) {
if ($record['sold'] == "FALSE") {
if ($prevInGr != $record['in_group']) {
echo "<tr><td colspan='10'><h7>ПАРА № " . $record['in_group'] . ":</h7></td></tr>";
$prevInGr = $record['in_group'];
}
echo "<tr>
<td>
 
</td>
<td>
<h7>" . $record['operator'] . $record['number'] . "</h7> 
</td>
<td>
<h7>" . $record['price'] . $record['curr'] . "</h7>
</td>";
echo "<td><a href=\"buy.php?NmBuy=" . $record['in_group'] . "&PrBuy=".$record['price']."\" rel=\"lightbox[buy 620 380]\"><img src='images/buy.png'></a></td>";
echo "</tr>";
}
}
echo"</table>
</form>";
}
else
echo "<h3> На данный момент нет парных номеров.</h3>";
}
else {
if ($_GET["pag"])
$page = (int) $_GET["pag"];
else
$page = 1;

preg_match('/^[0-9]{3}$/', $_GET['operator'], $operator);

$operator = $operator[0];
$per_page = 250;
$q = "SELECT count(*) FROM numbers where operator like '%" . $operator . "%'";
$res = mysql_query($q);
$row = mysql_fetch_row($res);
$total_rows = $row[0];
$num_pages = ceil($total_rows / $per_page);
$offset = ($page - 1) * $per_page;
if ($operator) {
/*print "<table border=0 width=\"150\" align=\"right\">
<tr><td >";
if ($page > 1)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=1&operator=" . $operator . "\"<b>Весь список</b></a>";
else
print "<b>Весь список</b>";
print "</td><td >";
if ($page > 1)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=" . ($page - 1) . "&operator=" . $operator . "\"></a>";
else
print "";
print "</td><td align=\"center\" >" . "<form name=\"PgForm\" method='GET' action='" . basename($_SERVER["PHP_SELF"]) . "'><input name=operator type=\"hidden\" value=\"" . $operator . "\"><select onchange=\"document.PgForm.submit();\" type=text name=pag>
";
for ($i = 1; $i <= $num_pages; $i++) {
echo "<option";
if ($page == $i)
echo " selected"; echo " value=$i>$i</option>";
}echo "</select></form></td><td align=\"right\" >";
if (($page + 1) <= $num_pages)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=" . ($page + 1) . "&operator=" . $operator . "\"></a>";
else
print "";
print "</td><td >";
if ($page < $num_pages)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=$num_pages&operator=" . $operator . "\"></a>";
else
print "";
print "</td></tr></table><br><br>";*/

$html = '<div id="pagination" style="float:right;">Перейти на страницу: ';
for ($i = 1; $i <= $num_pages; $i++) {
$html .= "<a href=\"".basename($_SERVER["PHP_SELF"])."?operator=".$operator."&pag=".$i."\">".$i."</a>";
}


$html .= '</div><div style="clear:both;"></div>';

$html .= '<div id="price"><b><font color="#0000ff">ВОСПОЛЬЗУЙТЕСЬ УДОБНОЙ СОРТИРОВКОЙ НОМЕРОВ ПО ЦЕНЕ:</font></b>
<a href="'.basename($_SERVER["PHP_SELF"])."?operator=".$operator."&pag=".$page.'&sort=up">по возрастанию</a>
<a href="'.basename($_SERVER["PHP_SELF"])."?operator=".$operator."&pag=".$page.'&sort=down">по убыванию</a>
</div>';
echo $html;

if( isset($_GET['sort']) ){

if( $_GET['sort'] == 'up' ){
$order = 'order by price';
}elseif( $_GET['sort'] == 'down' ){
$order = 'order by price DESC';
}else{
$order = 'order by id';
}
}else{
$order = 'order by id';
}

$sql = mysql_query("SELECT * FROM numbers where operator like '%" . $operator . "%' ".$order." LIMIT $offset, $per_page");
}
else {
if ($_GET['mtc']) {
if ($_GET["pag"])
$page = (int) $_GET["pag"];
else
$page = 1;
$per_page = 250;
$q = "SELECT count(*) FROM numbers where operator like '%050%' OR operator like '%066%' OR operator like '%099%' OR operator like '%095%'";
$res = mysql_query($q);
$row = mysql_fetch_row($res);
$total_rows = $row[0];
$num_pages = ceil($total_rows / $per_page);
$offset = ($page - 1) * $per_page;
/*print "<table border=0 width=\"150\" align=\"right\">
<tr><td >";
if ($page > 1)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=1&mtc=" . $_GET['mtc'] . "\" <b>Весь список</b></a>";
else
print "<b>Весь список</b>";
print "</td><td >";
if ($page > 1)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=" . ($page - 1) . "&mtc=" . $_GET['mtc'] . "\"></a>";
else
print "";
print "</td><td align=\"center\" >" . "<form name=\"PgForm\" method='GET' action='" . basename($_SERVER["PHP_SELF"]) . "'><input name=mtc type=\"hidden\" value=\"" . $_GET['mtc'] . "\"><select onchange=\"document.PgForm.submit();\" type=text name=pag>
";
for ($i = 1; $i <= $num_pages; $i++) {
echo "<option";
if ($page == $i)
echo " selected"; echo " value=$i>$i</option>";
}echo "</select></form></td><td align=\"right\" >";
if (($page + 1) <= $num_pages)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=" . ($page + 1) . "&mtc=" . $_GET['mtc'] . "\"></a>";
else
print "";
print "</td><td >";
if ($page < $num_pages)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=$num_pages&mtc=" . $_GET['mtc'] . "\"></a>";
else
print "";
print "</td></tr></table><br><br>";*/
$html = '<div id="pagination" style="float:right;">Перейти на страницу: ';
for ($i = 1; $i <= $num_pages; $i++) {
$html .= "<a href=\"".basename($_SERVER["PHP_SELF"])."?mtc=".'all'."&pag=".$i."\">".$i."</a>";
}

$html .= '</div><div style="clear:both;"></div>';

$html .= '<div id="price"><b><font color="#0000ff">ВОСПОЛЬЗУЙТЕСЬ УДОБНОЙ СОРТИРОВКОЙ НОМЕРОВ ПО ЦЕНЕ:</font></b>
<a href="'.basename($_SERVER["PHP_SELF"])."?mtc=".'all'."&pag=".$page.'&sort=up">по возрастанию</a>
<a href="'.basename($_SERVER["PHP_SELF"])."?mtc=".'all'."&pag=".$page.'&sort=down">по убыванию</a>
</div>';

echo $html;
if( isset($_GET['sort']) ){
if( $_GET['sort'] == 'up' ){
$order = 'order by price';
}elseif( $_GET['sort'] == 'down' ){
$order = 'order by price DESC';
}else{
$order = 'order by id';
}
}else{
$order = 'order by id';
}
$sql = mysql_query("SELECT * FROM numbers where operator like '%050%' OR operator like '%066%' OR operator like '%099%' OR operator like '%095%' ".$order." LIMIT $offset, $per_page");
}


if ($_GET['kvstar']) {
if ($_GET["pag"])
$page = (int) $_GET["pag"];
else
$page = 1;
$per_page = 250;
$q = "SELECT count(*) FROM numbers where operator like '%067%' OR operator like '%097%' OR operator like '%098%' OR operator like '%096%' OR operator like '%0xy%'";
$res = mysql_query($q);
$row = mysql_fetch_row($res);
$total_rows = $row[0];
$num_pages = ceil($total_rows / $per_page);
$offset = ($page - 1) * $per_page;
/* print "<table border=0 width=\"150\" align=\"right\">
<tr><td >";
if ($page > 1)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=1&kvstar=" . $_GET['kvstar'] . "\"><b>Весь список</b></a>";
else
print "<b>Весь список</b>";
print "</td><td >";
if ($page > 1)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=" . ($page - 1) . "&kvstar=" . $_GET['kvstar'] . "\"></a>";
else
print "";
print "</td><td align=\"center\" >" . "<form name=\"PgForm\" method='GET' action='" . basename($_SERVER["PHP_SELF"]) . "'><input name=kvstar type=\"hidden\" value=\"" . $_GET['kvstar'] . "\"><select onchange=\"document.PgForm.submit();\" type=text name=pag>
";
for ($i = 1; $i <= $num_pages; $i++) {
echo "<option";
if ($page == $i)
echo " selected"; echo " value=$i>$i</option>";
}echo "</select></form></td><td align=\"right\" >";
if (($page + 1) <= $num_pages)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=" . ($page + 1) . "&kvstar=" . $_GET['kvstar'] . "\"></a>";
else
print "";
print "</td><td >";
if ($page < $num_pages)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=$num_pages&kvstar=" . $_GET['kvstar'] . "\"></a>";
else
print "";
print "</td></tr></table><br><br>";*/
$html = '<div id="pagination" style="float:right;">Перейти на страницу: ';
for ($i = 1; $i <= $num_pages; $i++) {
$html .= "<a href=\"".basename($_SERVER["PHP_SELF"])."?kvstar=".'all'."&pag=".$i."\">".$i."</a>";
}

$html .= '</div><div style="clear:both;"></div>';

$html .= '<div id="price"><b><font color="#0000ff">ВОСПОЛЬЗУЙТЕСЬ УДОБНОЙ СОРТИРОВКОЙ НОМЕРОВ ПО ЦЕНЕ:</font></b>
<a href="'.basename($_SERVER["PHP_SELF"])."?kvstar=".'all'."&pag=".$page.'&sort=up">по возрастанию</a>
<a href="'.basename($_SERVER["PHP_SELF"])."?kvstar=".'all'."&pag=".$page.'&sort=down">по убыванию</a>
</div>';

echo $html;
if( isset($_GET['sort']) ){
if( $_GET['sort'] == 'up' ){
$order = 'order by price';
}elseif( $_GET['sort'] == 'down' ){
$order = 'order by price DESC';
}else{
$order = 'order by id';
}
}else{
$order = 'order by id';
}
$sql = mysql_query("SELECT*FROM numbers where operator like '%067%' OR operator like '%097%' OR operator like '%098%' OR operator like '%096%' OR operator like '%0xy%' ".$order." LIMIT $offset, $per_page");
}

if ($_GET['life']) {
if ($_GET["pag"])
$page = (int) $_GET["pag"];
else
$page = 1;
$per_page = 250;
$q = "SELECT count(*) FROM numbers where operator like '%063%' OR operator like '%093%'";
$res = mysql_query($q);
$row = mysql_fetch_row($res);
$total_rows = $row[0];
$num_pages = ceil($total_rows / $per_page);
$offset = ($page - 1) * $per_page;
/* print "<table border=0 width=\"150\" align=\"right\">
<tr><td >";
if ($page > 1)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=1&life=" . $_GET['life'] . "\"><b>Весь список</b></a>";
else
print "<b>Весь список</b>";
print "</td><td >";
if ($page > 1)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=" . ($page - 1) . "&life=" . $_GET['life'] . "\"></a>";
else
print "";
print "</td><td align=\"center\" >" . "<form name=\"PgForm\" method='GET' action='" . basename($_SERVER["PHP_SELF"]) . "'><input name=life type=\"hidden\" value=\"" . $_GET['life'] . "\"><select onchange=\"document.PgForm.submit();\" type=text name=pag>
";
for ($i = 1; $i <= $num_pages; $i++) {
echo "<option";
if ($page == $i)
echo " selected"; echo " value=$i>$i</option>";
}echo "</select></form></td><td align=\"right\" >";
if (($page + 1) <= $num_pages)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=" . ($page + 1) . "&life=" . $_GET['life'] . "\"></a>";
else
print "";
print "</td><td >";
if ($page < $num_pages)
print "<a style='color: #646464;
font-family: Tahoma;
font-size: 12px;
text-align: left;' href=\"" . basename($_SERVER["PHP_SELF"]) . "?pag=$num_pages&life=" . $_GET['life'] . "\"></a>";
else
print "";
print "</td></tr></table><br><br>";*/

$html = '<div id="pagination" style="float:right;">Перейти на страницу: ';
for ($i = 1; $i <= $num_pages; $i++) {
$html .= "<a href=\"".basename($_SERVER["PHP_SELF"])."?life=".'all'."&pag=".$i."\">".$i."</a>";
}

$html .= '</div><div style="clear:both;"></div>';

$html .= '<div id="price"><b><font color="#0000ff">ВОСПОЛЬЗУЙТЕСЬ УДОБНОЙ СОРТИРОВКОЙ НОМЕРОВ ПО ЦЕНЕ:</font></b>
<a href="'.basename($_SERVER["PHP_SELF"])."?life=".'all'."&pag=".$page.'&sort=up">по возрастанию</a>
<a href="'.basename($_SERVER["PHP_SELF"])."?life=".'all'."&pag=".$page.'&sort=down">по убыванию</a>
</div>';

echo $html;
if( isset($_GET['sort']) ){
if( $_GET['sort'] == 'up' ){
$order = 'order by price';
}elseif( $_GET['sort'] == 'down' ){
$order = 'order by price DESC';
}else{
$order = 'order by id';
}
}else{
$order = 'order by id';
}
$sql = mysql_query("SELECT*FROM numbers where operator like '%063%' OR operator like '%093%' ".$order." LIMIT $offset, $per_page");
//$sql = '';
}
}
if (mysql_num_rows($sql)) {
echo "<form method=\"post\">
<table style='width:100%;padding:10px;' >";
while ($record = mysql_fetch_array($sql)) {
if ($record['sold'] == "FALSE") {
echo "<tr>
<td>
<h7>Номер абонента:</h7> 
</td>
<td>
<h8>" . $record['operator'] . $record['number'] . "</h8> 
</td><td>";
echo ($record['old_price'])?"
<h6 class='old_price'>" . $record['old_price'].$record['curr']."</h6>
":"";
echo "</td>
<td>
<h5>" . $record['price'] . $record['curr'] . "</h5>
</td>";
echo "<td><a href=\"buy.php?NmBuy=" . $record['operator'] . $record['number'] . "&PrBuy=".$record['price']."\" rel=\"lightbox[buy 620 380]\"><img src='images/buy.png'></a></td>";
echo "</tr>";
}
}
echo"</table>
</form>";
}
else
echo "<h3> На данный момент нет номеров.</h3>";
}
?>
</div>
<?php
$html = '<div id="pagination" style="float:right;">Перейти на страницу: ';
for ($i = 1; $i <= $num_pages; $i++) {

if( isset($srchPars ) )
$html .= "<a href=\"".basename($_SERVER["PHP_SELF"])."?srchPars=true&pag=".$i."\">".$i."</a>";
if( isset($operator) )
$html .= "<a href=\"".basename($_SERVER["PHP_SELF"])."?operator=".$operator."&pag=".$i."\">".$i."</a>";

if ( isset($_GET['mtc']) )
$html .= "<a href=\"".basename($_SERVER["PHP_SELF"])."?mtc=".'all'."&pag=".$i."\">".$i."</a>";

if ( isset($_GET['kvstar']) )
$html .= "<a href=\"".basename($_SERVER["PHP_SELF"])."?kvstar=".'all'."&pag=".$i."\">".$i."</a>";

if ( isset($_GET['life']) )
$html .= "<a href=\"".basename($_SERVER["PHP_SELF"])."?life=".'all'."&pag=".$i."\">".$i."</a>";
}

$html .= '</div>';
echo $html;
?>
<?php
include('footer.php');
?>

В части кода


if (mysql_num_rows($sql)) {
echo "<form method=\"post\">
<table style='width:100%;padding:10px;' >";
while ($record = mysql_fetch_array($sql)) {
if ($record['sold'] == "FALSE") {
echo "<tr>
<td>
<h7>Номер абонента:</h7> 
</td>
<td>
<h8>" . $record['operator'] . $record['number'] . "</h8> 
</td><td>";
echo ($record['old_price'])?"
<h6 class='old_price'>" . $record['old_price'].$record['curr']."</h6>
":"";
echo "</td>
<td>
<h5>" . $record['price'] . $record['curr'] . "</h5>
</td>";
echo "<td><a href=\"buy.php?NmBuy=" . $record['operator'] . $record['number'] . "&PrBuy=".$record['price']."\" rel=\"lightbox[buy 620 380]\"><img src='images/buy.png'></a></td>";
echo "</tr>";
}
}
echo"</table>
</form>";
}

Надо вместо "номер абонента" вставить картинку соответствующего оператора. Прошу помочь

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Ну так вместо "номер абонента" вставить <img src="УРЛ картинки">

УРЛ картинки - пропишите путь к картинке.

Надо, чтобы автоматически определяло оператора

Ну так вместо "номер абонента" вставить <img src="УРЛ картинки">

УРЛ картинки - пропишите путь к картинке.

Надо, чтобы автоматически определяло оператора

и ставило соответствующую картинку
Link to comment
Share on other sites

  • 0

Определить переменную


$operator_img_url;

Присвоить ей значение УРЛа необходимой картинки


switch($record['operator'])
{
case 'Оператор А':
$operator_img_url = 'operator_a.jpg';
break;
case 'Оператор B':
$operator_img_url = 'operator_b.jpg';
break;
case 'Оператор C':
$operator_img_url = 'operator_c.jpg';
break;
}

операторов и адреса картинок замените на правильные

вместо следующего


echo "<tr>
<td>
<h7>Номер абонента:</h7> 
</td>
<td>
<h8>" . $record['operator'] . $record['number'] . "</h8> 
</td><td>";

вставить это:


echo "<tr>
<td>
<h7><img src='.$operator_img_url.'>:</h7> 
</td>
<td>
<h8>" . $record['operator'] . $record['number'] . "</h8> 
</td><td>";

как-то так.

Edited by Daiver
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy