Reply to PHP Mysql Query Looping - Help

Your name:

Reply:


Posted by solpraiaferias@gmail.com on 12/11/06 18:51

Sorry to bother folks but have been going mad the past 48 hours.

Have done something wrong but cannot see it!

I have php code retrieving results from mysql database and displaying
to web page on my site:

see development page at:

http://www.solpraiaferias.com/surfalgarve/test_surf.php

You will see that it is looping and displaying the results several
times.

I have already tried php sites, manuals etc, tried all the options I
can see, and cannot for the life of me see where I've gone wrong.

If anyone could have a couple of minutes to see what the heck
I've done wrong would be most appreciative....

Many Thanks


George Kennedy

*************************************************************************************************

Code as follows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link type="text/css" href="spf_surf.css" rel="stylesheet">
<body style="color: rgb(0, 0, 0); background-color: rgb(254, 254,
254);" leftmargin="0" topmargin="0" alink="#000099" link="#000099"
marginheight="0" marginwidth="0" vlink="#990099">
<?php

// Connects to your Database

require_once("../spf_connect.php");

// default algarve surf page

$lang="en";

Print "<table>";
Print "<tr>";
Print "<td colspan=\"4\" align=\"center\">";

$sql_surf = "SELECT
CASAS.area_id,CASAS.casa_id,CASAS.casa_nom,CASAS.quartos,CASAS.pessoas,CASAS.preco_natal,CASAS.
preco_jan,CASAS. preco_fev,CASAS. preco_mar,CASAS. preco_abr,CASAS.
preco_mai,CASAS. preco_jun,CASAS. preco_jul,CASAS. preco_ago,CASAS.
preco_set,CASAS. preco_out,CASAS. preco_nov,CASAS. preco_dez,CASAS.
preco_pascoa,CASAS.casa_text_en,CASAS.form_url_en,CASAS.cas_img_ref_1,CASAS.surf,CASAS.active,TOWNS.area_id,TOWNS.name,TOWNS.text_en,TOWNS.text_2_en,TOWNS.img_ref_2
FROM CASAS,TOWNS WHERE CASAS.surf='Yes' AND CASAS.active='Yes' LIMIT 0,
30 ";

$surf_result = mysql_query($sql_surf) or die(mysql_error());

Print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"
width=\"95%\" align=\"center\">";

while($surf_row_1 = mysql_fetch_array( $surf_result,MYSQL_ASSOC ))
{
Print "<tr>";
Print "<td colspan=\"8\"><img alt=\" \" src=\"images/prop_baa.jpg\"
vspace=\"5\"></td>";
Print "</tr>";
Print "<tr>";
Print "<td></td>";
Print "<td colspan=\"6\">";
Print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"
width=\"95%\" align=\"center\">";
Print "<tr>";
Print "<td><div align=\"left\" class=\"textgreen2menu\">"
..$surf_row_1['casa_nom'] . "</div></td>";
Print "<td><div align=\"right\" class=\"textgreen2menu\">" .
$surf_row_1['casa_id'] . "</div></td>";
Print "</tr>";
Print "<tr height=\"20\">";
Print "<td colspan=\"8\" valign=\"middle\"><hr size=\"2\
align=\"center\" NOSHADE></td>";
Print "</tr>";
Print "<tr>";
Print "<td valign=\"middle\"><div align=\"justify\"
class=\"casas_text_body\"><a href=" . $surf_row_1['form_url_en'] ."
class=\"casas_text_body\">".$surf_row_1['casa_text_en'] .
"</a></div></td>";
Print "<td rowspan=\"2\" align=\"right\" valign=\"top\"><img
src=\"../images/".$surf_row_1['cas_img_ref_1']."\" hspace=\"5\"
vspace=\"8\"></td>";
Print "</tr>";
Print "<tr>";
Print "<td>";
Print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"
width=\"95%\" align=\"center\">";
Print "<tr>";
Print "<td bgcolor=\"#d5d7ec\"><div class=\"price_green\">Sleeps " .
$surf_row_1['pessoas'] . "</div></td>";
Print "<td bgcolor=\"#d5d7ec\"><div class=\"price_green\">Rooms " .
$surf_row_1['quartos'] . "</div></td>";
Print "</tr>";
Print "</table>";
Print "</td>";
Print "</tr>";
Print "<tr>";
Print "<td colspan=\"2\">";
Print "<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\"
width=\"95%\" align=\"center\">";
Print "<tr height=\"20\">";
Print "<td colspan=\"7\" valign=\"top\"><div align=\"left\"
class=\"price_head\"><strong>Prices per property per
week:</strong></div></td>";
Print "</td>";
Print "</tr>";
Print "<tr>";
Print "<td bgcolor=\"#d5d7ec\"><div class=\"price_green\"> January -
&#128;" . $surf_row_1['preco_jan'] . "</div></td>";
Print "<td><div class=\"price_green\"> February - &#128;" .
$surf_row_1['preco_fev'] . "</div></td>";
Print "<td bgcolor=\"#d5d7ec\"><div class=\"price_green\"> March -
&#128;" . $surf_row_1['preco_mar'] . "</div></td>";
Print "<td><div class=\"price_green\"> April - &#128;" .
$surf_row_1['preco_abr'] . "</div></td>";
Print "<td bgcolor=\"#d5d7ec\"><div class=\"price_green\"> May -
&#128;" . $surf_row_1['preco_mai'] . "</div></td>";
Print "<td><div class=\"price_green\"> June - &#128;" .
$surf_row_1['preco_jun'] . "</div></td>";
Print "<td bgcolor=\"#d5d7ec\"><div class=\"price_green\"> Easter. -
&#128;" . $surf_row_1['preco_pascoa'] . "</div></td>";
Print "</tr>";
Print "<tr>";
Print "<td><div class=\"price_green\"> July - &#128;" .
$surf_row_1['preco_jul'] . "</div></td>";
Print "<td bgcolor=\"#d5d7ec\"><div class=\"price_green\"> August -
&#128;" . $surf_row_1['preco_ago'] . "</div></td>";
Print "<td><div class=\"price_green\"> September - &#128;" .
$surf_row_1['preco_set'] . "</div></td>";
Print "<td bgcolor=\"#d5d7ec\"><div class=\"price_green\"> October -
&#128;" . $surf_row_1['preco_out'] . "</div></td>";
Print "<td><div class=\"price_green\"> November - &#128;" .
$surf_row_1['preco_nov'] . "</div></td>";
Print "<td bgcolor=\"#d5d7ec\"><div class=\"price_green\"> December -
&#128;" . $surf_row_1['preco_dez'] . "</div></td>";
Print "<td><div class=\"price_green\"> Christmas - &#128;" .
$surf_row_1['preco_natal'] . "</div></td>";
Print "</tr>";
Print "</table>";
Print "</td>";
Print "</tr>";
Print "</table>";
Print "</td>";
Print "</tr>";
mysql_close($dbh);
}
Print "</table>";

Print "</td>";
Print "</tr>";
Print "</table>";

?>
</body>
</html>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация