Hi
I am new to php coding and trying list products by country - my code are as below .
I want to list tours by country say tours from x country listed one page from y listed on another page.
Thanks for your help
<?
include "config.php";
?>
<?
function view_turlar(){
global $id;
$queryupdate = "select * from turlar where id = '$id'";
$resultupdate = mysql_query($queryupdate);
$numberupdate = mysql_num_rows($resultupdate);
if ($numberupdate>0) {
$x=0;
while ($x<$numberupdate)
{
$ulkesehir=mysql_result($resultupdate,$x,"ulkesehir");
$tur_adi=mysql_result($resultupdate,$x,"tur_adi");
$facility=mysql_result($resultupdate,$x,"facility");
$fiyati=mysql_result($resultupdate,$x,"fiyati");
$x++;
} // end while
} // end if
} // end function view_turlar
function index_turlar(){
global $offcolor,$oncolor,$tblhead,$sortby,$start,$pagelimit,$id,$ulkesehir,$tur_adi,$facility,$fiyati,$ip,$tarih;
# echo "<a href=turlar.php?act=new>"._NEWRECORD."</a><br>\n";
$pagelimit = 30;
$initstart = 0;
if (!isset($start)){$start = $initstart;}
$querylimit = " limit $start,$pagelimit ";
$nextstart = $start + $pagelimit;
$previousstart = $start - $pagelimit;
$keyword = mysql_escape_string($_GET['keyword']);
if (!$keyword) $where = "";
else $where = " where ulkesehir like '%$keyword%' or tur_adi like '%$keyword%' or facility like '%$keyword%' ";
if ($sortby!=""){$sorted = " order by $sortby ";}
$query_turlar = "select id,ulkesehir,tur_adi,facility,fiyati,ip,tarih from turlar ";
$queryall = $query_turlar.$where.$sorted.$querylimit;
$resultall = mysql_query($queryall);
$numberall = mysql_numrows($resultall);
if ($numberall==0) {echo ""._NORECORD."";}
else if ($numberall>0) {
$x=0;
// echo "<b>"._TURLAR." "._LIST."</b>\n";
echo "<table border=0 cellspacing=1 cellpadding=1>\n";
echo " <tr bgcolor=\"$tblhead\">\n";
echo " <td><b>Location</b></td>\n";
echo " <td><b>Tour Title</b></td>\n";
echo " <td><b> Description</b></td>\n";
echo " <td><b>Price</b></td>\n";
// echo " <td><b><a href=\"update_tours.php?sortby=ip&start=$start&pagelimit=$pagelimit&keyword=$keyword\">"._IP."</a></b></td>\n";
// echo " <td><b><a href=\"update_tours.php?sortby=tarih&start=$start&pagelimit=$pagelimit&keyword=$keyword\">"._TARIH."</a></b></td>\n";
// echo " <td colspan=3><b>".Book."</b></td>\n";
echo " </tr>\n";
while ($x<$numberall)
{
// changing background color for each alternate row
if (($x%2)==0) { $bgcolor="#C8D2F2"; } else { $bgcolor="#E4E4E4"; }
// retreiving data and putting it in local variables for each row
$id=mysql_result($resultall,$x,"id");
$ulkesehir=mysql_result($resultall,$x,"ulkesehir");
$tur_adi=mysql_result($resultall,$x,"tur_adi");
$facility=mysql_result($resultall,$x,"facility");
$fiyati=mysql_result($resultall,$x,"fiyati");
//$ip=mysql_result($resultall,$x,"ip");
//$tarih=mysql_result($resultall,$x,"tarih");
echo "<tr bgcolor=\"$bgcolor\">\n";
echo " <td>$ulkesehir </td>\n";
echo " <td><a href=\"turkeytour.php?act=view&id=$id\" title=\"$tur_adi\">$tur_adi</a></td>\n";
echo " <td>".strtolower(substr(strip_tags($facility),0,40))."...</td>\n";
echo " <td>".strtolower(substr(strip_tags($fiyati),0,40))."...</td>\n";
//echo " <td><a href=\"checktour.php?act=view&id=$id\"‚¨–â‚¢‡‚킹ƒtƒH[ƒ€‚Í‚±‚¿‚ç\">‚¨–â‚¢‡‚킹ƒtƒH[ƒ€‚Í‚±‚¿‚ç</a></td>\n";
?>
<?
$x++;
} // end while
if ($prev_page){
}
for ($i = 1; $i <= $num_pages; $i++) {
if ($i != $page) {
} else {
}
}
if ($page != $num_pages){
}
} // end if numberall > 0
} // end function index_turlar
?>
<?
function baska_list(){
$data = mysql_query("SELECT id,ulkesehir,tur_adi,facility,fiyati,ip,tarih FROM turlar");
while(list($id,$ulkesehir,$tur_adi,$facility,$fiyati,$ip,$tarih) = mysql_fetch_row($data)) {
echo "$ulkesehir,$tur_adi,$facility,$fiyati,$ip,$tarih<br>";
}
} // end function
switch($act) {
case "view":
view_turlar();
break;
case "reserve1":
reserve1_turlar();
break;
default:
index_turlar();
break;
}
// color settings
$tblhead = "#FF9933";
$oncolor = "#FFCC66";
$offcolor = "#FFFFFF";
//general
define("_NORECORD","No Data Exist !");
define("_RECORDNOTFOUND","No Records Found !");
define("_SEARCHRESULT","Search Result");
define("_INSERTOK","New data created.");
define("Book ","Actions");
define("_EDIT","Edit");
define("_DELETE","‚¨–â‚¢‡‚킹ƒtƒH[ƒ€‚Í‚±‚¿‚ç");
define("_DETAIL","View");
define("_YOUSURE","Are you sure?");
define("_YES","Yes");
define("_NO","No");
define("_RECORDDELETED","Data Deleted");
define("_RECORD","Record");
define("_UPDATERECORD","Edit Data");
define("_RECORDUPDATED","Data Updated");
define("_PREVIOUS","Prev");
define("_NEXT","Next");
define("_SAVE"," Save");
define("_RESET","Reset");
define("_UPDATE","Update");
define("_SEARCH","Search");
define("_LIST","List");
define("_WRITEKEYWORD","Please type word(s) in search box");
define("_SEARCHDATABASE","Search database");
define("_FORMINCOMPLETE","LEfen formu doldurun...");
define("_PAGES","Page(s)");
define("_TURLAR","TURLAR");
define("_ID","Id");
define("_ULKESEHIR","ulkesehir");
define("_TUR_ADI","Tur_adi");
define("_FACILITY","Facility");
define("_FIYATI","Fiyati");
define("_IP","Ip");
define("_TARIH","Tarih");
?>