Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
For Professional PHP Programmer Only
Old 10-08-2007, 09:11 AM For Professional PHP Programmer Only
ISSC's Avatar
Skilled Talker

Posts: 65
Name: A. Mansouri
Location: Jeddah, K.S.A
Trades: 0
Dear Professional PHP Programmer,

Simply: It's Travel Agency script, Searching Hotel rates in different seasons.

Hardly: I have built a search page looking for available Hotels in posted Date [From-To].
- Rates maybe different between season and other.
Here is the demo page:
http://sms.showlag.com/demo/need_help.php

What happening currently in demo page to calculate the total Rate:
(First day rate) * (Total Nights) = (Total Rate)
And That's Not True, Why?
What should be to calculate the total Rate:
Get total nights, day by day rate, then calculate them all.
Because maybe there is one or more day not in season rate, Or maybe in different season rate.
This code locates between Line 348:
PHP Code:
// I Need Your Help Below This Line 
And Line 351:
PHP Code:
// I Need Your Help Above This Line 
Also I want to sort this date rates in table like current demo page example table,
When you search for: Egypt -> Cairo (for example), you will see what I'm talked about above (Total), when you click the total you will see the example table rate day by day (It's Not realty at all, Just for Example in HTML code).
This table locates between Line 375:
HTML Code:
<!-- I Need Your Help Below This Line --!>
And Line 392:
HTML Code:
<!-- I Need Your Help Above This Line --!>
Here is the demo page need_help.php code:
PHP Code:
<?PHP
///////////////////////////////////////////////
//###########################################//
//                                           //
//       Travel Agency Script V 1.0.0        //
//         Developed By: ISSC.WS             //
//      Tech Support: support@issc.ws        //
//      Last Updated On: 01/Oct/2007         //
//                                           //
//###########################################//
///////////////////////////////////////////////
// Including Header data...
 
include ("db.inc.php");
 
 
$City_ID        $_POST["City"];
 
$Room_Kind      $_POST["room_kind"];
 
$Total_Nights   $_POST["total_nights"];
 
 
$Check_In       mktime(0,0,0$_POST["check_in_m"], $_POST["check_in_d"], $_POST["check_in_y"]);
 
$Check_Out      mktime(0,0,0$_POST["check_in_m"], $_POST["check_in_d"]+$Total_Nights$_POST["check_in_y"]);
 
$Check_In_Date  date("Y-m-d"$Check_In);
 
$Check_Out_Date date("Y-m-d"$Check_Out);
 
$Print_ChkIn_D  date("d/m/Y"$Check_In);
 
$Print_ChkOut_D date("d/m/Y"$Check_Out);
 
$Today_Date     date("Y-m-d");
 
$Option_Day "<option value='01'>01</option>
        <option value='02'>02</option>
        <option value='03'>03</option>
        <option value='04'>04</option>
        <option value='05'>05</option>
        <option value='06'>06</option>
        <option value='07'>07</option>
        <option value='08'>08</option>
        <option value='09'>09</option>
        <option value='10'>10</option>
        <option value='11'>11</option>
        <option value='12'>12</option>
        <option value='13'>13</option>
        <option value='14'>14</option>
        <option value='15'>15</option>
        <option value='16'>16</option>
        <option value='17'>17</option>
        <option value='18'>18</option>
        <option value='19'>19</option>
        <option value='20'>20</option>
        <option value='21'>21</option>
        <option value='22'>22</option>
        <option value='23'>23</option>
        <option value='24'>24</option>
        <option value='25'>25</option>
        <option value='26'>26</option>
        <option value='27'>27</option>
        <option value='28'>28</option>
        <option value='29'>29</option>
        <option value='30'>30</option>
        <option value='31'>31</option>"
;
 
$Option_Month "<option value='01'>Jan</option>
        <option value='02'>Feb</option>
        <option value='03'>Mar</option>
        <option value='04'>Apr</option>
        <option value='05'>May</option>
        <option value='06'>Jun</option>
        <option value='07'>Jul</option>
        <option value='08'>Aug</option>
        <option value='09'>Sep</option>
        <option value='10'>Oct</option>
        <option value='11'>Nov</option>
        <option value='12'>Dec</option>"
;
 
$Option_Year  "<option value='2007'>2007</option>
        <option value='2008'>2008</option>
        <option value='2009'>2009</option>
        <option value='2010'>2010</option>"
;
 
$Get_City=mysql_query("SELECT * FROM `city` WHERE `id`='".$City_ID."'") or die("Can't connect to Country DB");
 
$row=@mysql_num_rows($Get_City);
  while(
$cit=mysql_fetch_array($Get_City)){
        
$City_Cid  $cit["cid"];
        
$City_Name $cit["c_name"];
                                          }
 
$Get_Ctry=mysql_query("SELECT * FROM `country` WHERE `id`='".$City_Cid."'") or die("Can't connect to Country DB");
 
$rows=@mysql_num_rows($Get_Ctry);
  while(
$cuo=mysql_fetch_array($Get_Ctry)){
        
$Country_Name $cuo["c_name"];
                                          }
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<LINK HREF="http://www.webmaster-talk.com/images/style.css" TYPE="text/css" REL="stylesheet">
<title>Select Hotel</title>
<script language="javascript">
 function ret(id){
 return document.getElementById(id);
                 }
 function changeCat(){
        if(!ret("Country"))return;
        var selectedCat = ret("Country").value;
        ret("subCat_"+curCombo).style.display = "none";
        ret("subCat_"+selectedCat).style.display = "inline";
        curCombo = selectedCat;
                     }
 function funHS(varObjID){
  if(document.getElementById(varObjID).style.display=="none"){
     document.getElementById(varObjID).style.display="block";
 }else{
     document.getElementById(varObjID).style.display="none";
      }
                         }
 function funShowAll(){ for(i=1; i<=10; i++){ document.getElementById(i).style.display="block"; funSImg(i); } }
 function funHideAll(){ for(i=1; i<=10; i++){ document.getElementById(i).style.display="none"; } }
          arrImgID = new Array(); arrImgN  = new Array();
</script>
</head>
<body style='margin: 0px; padding: 0px'>
      <table cellpadding="0" cellspacing="0" width="98%" height="98%" align="center" class='table'>
        <tr>
          <td height="66%" align="center">
<?PHP
    $Note 
$_GET["msg"];
 if(
$Note){
 echo
"<center><br><b><font color='Red' size='3'>$Note</font></b><br></center>";
          }
 if(!
$_POST["submit"]){
?>
<Form method="POST" action="need_help.php" name="form" id="form">
  <table cellpadding="0" cellspacing="0" border="0" width="100%" align="center">
  <tr>
    <td align="center" colspan='2' height='30' class="td" background="http://www.webmaster-talk.com/images/td.bg.jpg"><b>Please choose your Place and Date of fly</b></td>
  </tr>
    <tr>
      <td width='30%' class='td' height='25'>&nbsp;&nbsp; <b>Country *:</b></td>
      <td width='70%' class="td">&nbsp;&nbsp; <select name="Country" size="1" onChange="redirect(this.options.selectedIndex)" class="drop">
          <option value=''>- Choose -</option>
<?PHP
 $get_coun
=mysql_query("SELECT * FROM `country` WHERE `active`='1' ORDER BY `id` ASC") or die("can't connect to Country DB");
 
$row_77=@mysql_num_rows($get_coun);
      while(
$osgc=mysql_fetch_array($get_coun)){
            
$Country_id   $osgc["id"];
            
$Country_name $osgc["c_name"];
 echo
"          <option value='$Country_id'>$Country_name</option>
"
;
                                               }
?>
        </select>
      </td>
    </tr>
    <tr>
      <td class='td' height='25'>&nbsp;&nbsp; <b>City *:</b></td>
      <td class="td">&nbsp;&nbsp;
        <select name='City' size='1' class='drop'>
          <option value=''>- Choose Country First -</option>
        </select>
<script>
var groups=document.form.Country.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
group[0][0]=new Option('- Choose Country First -','')
<?PHP
 $get_coun2
=mysql_query("SELECT * FROM `country` WHERE `active`='1' ORDER BY `id` ASC") or die("can't connect to Country DB");
 
$row_22=@mysql_num_rows($get_coun2);
      while(
$osgc2=mysql_fetch_array($get_coun2)){
            
$Country_id2 $osgc2["id"];
            
$ser_55      $ser_55 +1;
 
$get_ci=mysql_query("SELECT * FROM `city` WHERE `cid`='".$Country_id2."' AND `active`='1' ORDER BY `id` ASC");
 
$row_33=@mysql_num_rows($get_ci);
 
$reset 0;
 if(
$row_33!=0){
 echo 
"group[$ser_55][0]=new Option('- Choose City -','')
"
;
  while(
$osgc3=mysql_fetch_array($get_ci)){
      
$City_id1   $osgc3["id"];
      
$City_cid   $osgc3["cid"];
   if(
$reset     != $City_cid){
      
$reset      $City_cid;
      
$one_88     0;
                             }
      
$City_cid2  $osgc3["cid"];
      
$City_name2 $osgc3["c_name"];
      
$one_88     $one_88 1;
 echo 
"group[$ser_55][$one_88]=new Option('$City_name2','$City_id1')
"
;
                                          }
               }else{
 echo 
"group[$ser_55][0]=new Option('- No city available Now for this Country -','')
"
;
                    }
                                                 }
?>
 var temp=document.form.City
 function redirect(x){
 for (m=temp.options.length-1;m>0;m--)
 temp.options[m]=null
 for (i=0;i<group[x].length;i++){
 temp.options[i]=new Option(group[x][i].text,group[x][i].value)
                                }
 temp.options[0].selected=true
                     }
</script>
          </td>
        </tr>
        </tr>
        <tr>
          <td class='td' height='25'>&nbsp;&nbsp; <b>Check In Date *:</b></td>
          <td class="td">&nbsp;&nbsp; <select size='1' name='check_in_d' class='drop'>
                                        <?=$Option_Day;?>
                                      </select> / <select size='1' name='check_in_m' class='drop'>
                                        <?=$Option_Month;?>
                                      </select> / <select size='1' name='check_in_y' class='drop'>
                                        <?=$Option_Year;?>
                                      </select>
          </td>
        </tr>
        <tr>
          <td class='td' height='25'>&nbsp;&nbsp; <b>Total Nights *:</b></td>
          <td class='td'>&nbsp;&nbsp; <input type='text' size='2' name='total_nights'></td>
        </tr>
        <tr>
          <td class='td' height='25'>&nbsp;&nbsp; <b>Room Kind *:</b></td>
          <td class='td'>&nbsp;&nbsp; <select name='room_kind' size='1' class='drop'>
<?PHP
    $sql_kind
=mysql_query("SELECT * FROM `room_kind` ORDER BY `id` ASC") or die("can't connect to Room Kind DB");
    
$row_k=@mysql_num_rows($sql_kind);
 if(
$row_k!="0"){
     while(
$rk=mysql_fetch_array($sql_kind)){
           
$rk_id   $rk["id"];
           
$rk_name $rk["name"];
     echo
"<option value='$rk_id'>$rk_name</option>
"
;
                                            }
                }else{
     echo
"<option value='0'>--- Empty ---</option>";
                     }
?>
            </select>
          </td>
        </tr>
        <tr>
          <td bgcolor='#EAEAEA' class='td' colspan='2' align='center' height='30'><input type='submit' name='submit' value='     Search     '></td>
        </tr>
      </table>
</Form>
<?PHP
 
}elseif((empty($City_ID))||(empty($Room_Kind))||(empty($Total_Nights)) AND $_POST["submit"]){
 echo 
"<script language='JavaScript'>self.location.href='?msg=Please check the required fields.';</script>";
 exit();
 }elseif(
$Check_In_Date $Today_Date AND $_POST["submit"]){
 echo 
"<script language='JavaScript'>self.location.href='?msg=You should choose correct fly date.';</script>";
 exit();
 }else{
?>
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%" align="center" class='table'>
  <tr>
    <td colspan='3' align="center" height="30" class="td" background="http://www.webmaster-talk.com/images/td.bg.jpg"><b>Integrated Search Results...</b></td>
  </tr>
  <tr>
    <td align="center" class='td' height='30'>Hotel Location: <b><?=$Country_Name;?> >> <?=$City_Name;?></b></td>
    <td align="center" class='td'>Room Kind:
<?PHP
    $rom_kind
=mysql_query("SELECT * FROM `room_kind` WHERE `id`='".$Room_Kind."'") or die("can't connect to Room Kind DB");
    
$rowk=@mysql_num_rows($rom_kind); while($rk=mysql_fetch_array($rom_kind)){echo $rk["name"];}
?>
    </td>
    <td align="center" class='td'>From: <?=$Print_ChkIn_D?> To: <?=$Print_ChkOut_D?></td>
  </tr>
  <tr>
    <td align="center" class='td'>Hotel Name</td>
    <td align="center" class='td'>Stars</td>
    <td align='center' class='td'>
      <table cellpadding="0" cellspacing="0" border="0" width="100%" height="10" align="center">
        <tr>
          <td width='25%' align='center' class='small_text' height='25'><b>Room Level</b></td>
          <td width='25%' align='center' class='small_text'><b>Agency</b></td>
          <td width='25%' align='center' class='small_text'><b>Total Cost</b></td>
          <td width='25%' align="center" class='small_text'><b>Choose</b></td>
        </tr>
      </table>
    </td>
   </tr>
<?PHP
 $hotel
=mysql_query("SELECT * FROM `hotel` WHERE `cid`='".$City_ID."' AND `active`='1' ORDER BY `id` ASC") or die("can't connect to Hotel DB");
 
$ro=@mysql_num_rows($hotel);
 if(
$ro != "0"){
 while(
$ht=mysql_fetch_array($hotel)){
       
$Hotel_ID    $ht["id"];
       
$Hotel_Name  $ht["h_name"];
       
$Hotel_stars $ht["stars"];
 
$Get_Price=mysql_query("SELECT * FROM `room_price` WHERE `hid`='".$Hotel_ID."' AND `r_kind`='".$Room_Kind."' AND `start_date` <= '".$Check_In_Date."' AND `end_date` >= '".$Check_In_Date."' ORDER BY `id` ASC") or die("can't connect to Hotel DB");
 
$rowp=@mysql_num_rows($Get_Price);
 if(
$rowp != "0"){
?>
  <tr>
    <td width='30%' align="center" class='td' height='25'><?=$Hotel_Name?></td>
    <td width='20%' align="center" class='td'><img src='images/stars/<?PHP if($Hotel_stars=="1"){echo"1";} if($Hotel_stars=="2"){echo"2";} if($Hotel_stars=="3"){echo"3";} if($Hotel_stars=="4"){echo"4";} if($Hotel_stars=="5"){echo"5";}?>.gif' vspace='2' title='<?=$Hotel_Name;?> | <?=$Hotel_stars;?> Stars' border='0'></td>
    <td width='50%' align="center" class='td'>
      <table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%' align='center'>
<?PHP
 
while($cc=mysql_fetch_array($Get_Price)){
       
$cc_ID      $cc["id"];
       
$cc_Start_D $cc["start_date"];
       
$cc_end_D   $cc["end_date"];
       
$cc_agency  $cc["agency"];
       
$cc_price   $cc["price"];
       
$cc_r_level $cc["r_level"];
       
$cc_r_kind  $cc["r_kind"];
       
$tr_serial  $tr_serial+1;
       if(
$tr_serial 2==0){
          
$style     "style='background-color: #FFFFFF;'";
                            }
       else{
          
$style     "style='background-color: #EAEAEA;'";
           }
?>
        <tr <?=$style;?> />
          <td width='25%' align='center' class='small_text' height='25'>
<?PHP
    $rom_level
=mysql_query("SELECT * FROM `room` WHERE `id`='".$cc_r_level."'") or die("can't connect to Room DB");
    
$rowl=@mysql_num_rows($rom_level); while($rl=mysql_fetch_array($rom_level)){echo $rl["room_level"];}
?>
          </td>
          <td width='25%' align='center' class='small_text'>
<?PHP
    $get_agency
=mysql_query("SELECT * FROM `agency` WHERE `id`='".$cc_agency."'") or die("can't connect to Agency DB");
    
$rowa=@mysql_num_rows($get_agency); while($ag=mysql_fetch_array($get_agency)){echo $ag["ag_name"];}
?>
          </td>
          <td width='25%' align='center' class='small_text'><a href="javascript:funHS('<?=$cc_ID;?>')" class='small_text' style='text-decoration: none'>
<?PHP
// I Need Your Help Below This Line
    
$Total_Price $cc_price $Total_Nights;
    echo 
$Total_Price;
// I Need Your Help Above This Line
?>
          </a></td>
          <td width='25%' align="center" class='small_text'><a class="small_text" style='text-decoration: none' HREF='#' onClick="
self.opener.document.hotel.start_date.value='<?=$Check_In_Date;?>';
self.opener.document.hotel.end_date.value='<?=$Check_Out_Date;?>';
self.opener.document.hotel.total_price.value='<?=$Total_Price;?>';
self.opener.document.hotel.hotel_id.value='<?=$Hotel_ID;?>';
self.opener.document.hotel.agency_id.value='<?=$cc_agency;?>';
self.opener.document.hotel.r_level.value='<?=$cc_r_level;?>';
self.opener.document.hotel.r_kind.value='<?=$Room_Kind;?>';
window.close();">Choose</a>
          </td>
        </tr>
        <tr>
          <td colspan='5' align='center'>
          <DIV id="<?=$cc_ID;?>" style="display:none" align="center">
          <table cellpadding='0' cellspacing='0' border='0' width='100%' align='center' class='table'>
            <tr>
              <td width='50%' align='center' class='small_text_td'><b>Date</b></td>
              <td width='50%' align='center' class='small_text_td'><b>Cost</b></td>
            </tr>
<!-- I Need Your Help Below This Line --!>
            <tr>
              <td align='center' class='small_text'>DD/MM/YYYY</td>
              <td align='center' class='small_text'>$ XX.XXX</td>
            </tr>
            <tr>
              <td align='center' class='small_text'>DD+1/MM/YYYY</td>
              <td align='center' class='small_text'>$ XX.XXX</td>
            </tr>
            <tr>
              <td align='center' class='small_text'>DD+1+1/MM/YYYY</td>
              <td align='center' class='small_text'>N/A</td>
            </tr>
            <tr>
              <td align='center' class='small_text'>DD+1+1+1/MM/YYYY</td>
              <td align='center' class='small_text'>$ ZZ.XXX</td>
            </tr>
<!-- I Need Your Help Above This Line --!>
          </table>
          </DIV>
          </td>
        </tr>
<?PHP
                                         
}
?>
      </table>
    </td>
  </tr>
<?PHP
 
}else{
 echo 
"";
      }
                                     }
 }else{
 echo 
"<tr><td colspan='3' align='center' height='30' class='td'>No Hotels Available Under this City</td></tr>";
      }
?>
  <tr>
    <td bgcolor='#EAEAEA' colspan='3' align="center" height="40" class='td'><a href="?" class="link"><b>Back</b></a></td>
  </tr>
</table>
<?PHP
      
}
?>
          </td>
        </tr>
      </table>
</body>
</html>
I Need PHP function that select the posted days, day by day to look what each day rate is, from `room_price` Data Base Table Between Fields `start_date` AND `end_date`
- If day rate include between seasons, the price print.
- Else, the price will be N/A.
- Then print Total rates in $Total_Price.

Hope you got my point.

Note: You can get the file in attachment.

Best Regards, And Many Thanks in Advance,
A. Mansouri
Attached Files
File Type: zip need_help.zip (4.1 KB, 1 views)

Last edited by ISSC; 10-08-2007 at 09:13 AM.. Reason: Attachment File
ISSC is offline
Reply With Quote
View Public Profile Visit ISSC's homepage!
 
 
Register now for full access!
Old 10-08-2007, 09:33 AM Re: For Professional PHP Programmer Only
Ultra Talker

Posts: 483
Trades: 0
Man... is this the same problem as you were having at http://www.webmaster-talk.com/php-fo...te-travel.html ?

It doesn't seem to be any different...
__________________

Please login or register to view this content. Registration is FREE
TwistMyArm is offline
Reply With Quote
View Public Profile
 
Old 10-08-2007, 10:26 AM Re: For Professional PHP Programmer Only
ISSC's Avatar
Skilled Talker

Posts: 65
Name: A. Mansouri
Location: Jeddah, K.S.A
Trades: 0
Dear TwistMyArm,

Yes It's same, or Actually its updated version of same file,
Here I do everything expect the rate table and calculating Total.

If you can help me to write the code please, you'll short long time to me.

Best Regards,
A. Mansouri

Last edited by ISSC; 10-08-2007 at 10:30 AM..
ISSC is offline
Reply With Quote
View Public Profile Visit ISSC's homepage!
 
Old 10-08-2007, 08:12 PM Re: For Professional PHP Programmer Only
Ultra Talker

Posts: 483
Trades: 0
Sorry mate... I wish I could help you but I can all but guarantee that you can't afford me

Is the workflow I gave you that difficult to understand?
__________________

Please login or register to view this content. Registration is FREE
TwistMyArm is offline
Reply With Quote
View Public Profile
 
Old 10-11-2007, 09:36 AM Re: For Professional PHP Programmer Only
ISSC's Avatar
Skilled Talker

Posts: 65
Name: A. Mansouri
Location: Jeddah, K.S.A
Trades: 0
I hope somone else could help me


Thanks Twist..
ISSC is offline
Reply With Quote
View Public Profile Visit ISSC's homepage!
 
Old 10-22-2007, 11:14 AM Re: For Professional PHP Programmer Only
Mattmaul1992's Avatar
Ultra Talker

Posts: 486
Name: Matt
Trades: -1
Hey,
I've been absent for quite a while (new job) but I finally have time again (3-6 hours a day) to do PHP for whoever needs it so I'd gladly help if you still need it.
__________________
PHP Code:
$talkupation++; 

Please login or register to view this content. Registration is FREE
- Free IPB forum hosting (releasing today!!!), no ads, free modifications
Mattmaul1992 is offline
Reply With Quote
View Public Profile
 
Old 10-22-2007, 07:13 PM Re: For Professional PHP Programmer Only
ISSC's Avatar
Skilled Talker

Posts: 65
Name: A. Mansouri
Location: Jeddah, K.S.A
Trades: 0
Thanks Mattmaul1992,

Yes sure I still need your help.

Many Thanks,
A. Mansouri
ISSC is offline
Reply With Quote
View Public Profile Visit ISSC's homepage!
 
Old 10-23-2007, 05:38 PM Re: For Professional PHP Programmer Only
ISSC's Avatar
Skilled Talker

Posts: 65
Name: A. Mansouri
Location: Jeddah, K.S.A
Trades: 0
Hi,

Finaly I get the Code:
PHP Code:
<?PHP
 $get_curr
=mysql_query("SELECT * FROM `currency` WHERE `id`='".$ag_curr."'") or die("can't connect to Currency DB");
 
$rowc=@mysql_num_rows($get_curr); while($crr=mysql_fetch_array($get_curr)){$cur_value=$crr["value"]; $cur_type=$crr["type"];}
 for (
$i=1;$i<=$Total_Nights;$i++) {
 
$Start_D    mktime(0,0,0$_POST["check_in_m"], $_POST["check_in_d"]+$i$_POST["check_in_y"]);
 
$Sql_Date   date("Y-m-d"$Start_D);
 
$Print_Date date("d/m/Y"$Start_D);
 
$sql_price=mysql_query("SELECT * FROM `room_price` WHERE '".$Sql_Date."' BETWEEN `start_date` AND `end_date` AND `hid`='".$Hotel_ID."' AND `agency`='".$cc_agency."' AND `r_kind`='".$cc_r_kind."' AND `r_level`='".$cc_r_level."'") or die("can't connect to Room Price DB");
 
$roz=@mysql_num_rows($sql_price);
 if(
$roz!="0"){
  while(
$dp=mysql_fetch_array($sql_price)){
        
$Day_Price $dp["price"];
        
$Day_Price $Day_Price $cur_value;
                                          }
 echo 
"<tr>
         <td align='center' class='small_text_td'>
$Print_Date</td>
         <td align='center' class='small_text_td'>
$cur_type $Day_Price</td>
       </tr>"
;
              }
 else{
 echo 
"<tr>
         <td align='center' class='small_text_td'>
$Print_Date</td>
         <td align='center' class='small_text_td'>N/A</td>
       </tr>"
;
     }
                                   }
?>
Now Just I need the total cost for the Holiday,
It should be somthing like get each defined $Day_Price and them calculate them all.

Best Regards,
A. Mansouri
ISSC is offline
Reply With Quote
View Public Profile Visit ISSC's homepage!
 
Old 10-25-2007, 06:21 AM Re: For Professional PHP Programmer Only
ISSC's Avatar
Skilled Talker

Posts: 65
Name: A. Mansouri
Location: Jeddah, K.S.A
Trades: 0
Oh God I'm newbi proff in PHP

Now I fixed everything,
PHP Code:
<?PHP
 $get_agency
=mysql_query("SELECT * FROM `agency` WHERE `id`='".$cc_agency."'") or die("can't connect to Agency DB");
 
$rowa=@mysql_num_rows($get_agency); while($ag=mysql_fetch_array($get_agency)){$ag_curr=$ag["currency"]; $ag_name=$ag["ag_name"];}
 
$get_curr=mysql_query("SELECT * FROM `currency` WHERE `id`='".$ag_curr."'") or die("can't connect to Currency DB");
 
$rowc=@mysql_num_rows($get_curr); while($crr=mysql_fetch_array($get_curr)){$cur_value=$crr["value"]; $cur_type=$crr["type"];}
 for (
$i=1;$i<=$Total_Nights;$i++) {
 
$Start_D    mktime(0,0,0$_POST["check_in_m"], $_POST["check_in_d"]+$i$_POST["check_in_y"]);
 
$Sql_Date   date("Y-m-d"$Start_D);
 
$Print_Date date("d/m/Y"$Start_D);
 
$sql_price=mysql_query("SELECT * FROM `room_price` WHERE '".$Sql_Date."' BETWEEN `start_date` AND `end_date` AND `hid`='".$Hotel_ID."' AND `agency`='".$cc_agency."' AND `r_kind`='".$cc_r_kind."' AND `r_level`='".$cc_r_level."'") or die("can't connect to Room Price DB");
 
$roz=@mysql_num_rows($sql_price);
 if(
$roz!="0"){
  while(
$dp=mysql_fetch_array($sql_price)){
        
$Day_Price       $dp["price"];
        
$Dialy_Cost      $Day_Price $cur_value;
        
$Total_Cost      $Total_Cost $Dialy_Cost;
        
$Real_Num_Nights $Real_Num_Nights ;
                                          }
 echo 
"<tr>
         <td align='center' class='small_text_td'>
$Print_Date</td>
         <td align='center' class='small_text_td'>
$cur_type $Dialy_Cost</td>
       </tr>"
;
              }
 else{
 echo 
"<tr>
         <td align='center' class='small_text_td'>
$Print_Date</td>
         <td align='center' class='small_text_td'>N/A</td>
       </tr>"
;
     }
                                   }
?>
But I have only one error!
The Total Of night and Total Of Cost continuing calculating while results!

It should reset calculating in every start of new while.

How to reset ?

Best Regards,
A. Mansouri
ISSC is offline
Reply With Quote
View Public Profile Visit ISSC's homepage!
 
Reply     « Reply to For Professional PHP Programmer Only
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.31567 seconds with 13 queries