PHPrp
New Members-
Posts
4 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
PHPrp's Achievements
Newbie (1/5)
0
Reputation
-
Hi, Can anyone help with this little array problem? i have 2 scripts check_holiday_costings.php and check_holiday_costings2.php. i am attaching both scripts here. In particular i have problem with check_holiday_costings2.php and with header. in this scripts i m passing some headers to my database. here is a header code [code] $i=0; if($debug){ view_array2($pass_first_name,"pass_first_name"); } while (list($key, $value) = each ($pass_first_name)) { $room_group_number=$room_allocation[$key]; //$holiday_search.="NME ".$_SESSION["pass_title"][$i]." ".$_SESSION["pass_first_name"][$i]." ".$_SESSION["pass_surname"][$i]." ".$_SESSION["pass_day"][$i].$_SESSION["pass_month"][$i].$_SESSION["pass_year"][$i]." ".stripslashes($room_allocation[$i])." ".$room_group_number." $holiday_search.="NME ".$_SESSION["pass_title"][$key]." ".$_SESSION["pass_first_name"][$key]." ".$_SESSION["pass_surname"][$key]." ".$_SESSION["pass_day"][$key].$_SESSION["pass_month"][$key].$_SESSION["pass_year"][$key]." ".stripslashes($final_room_description[$room_allocation[$key]])." ".$room_group_number." "; $i++; } [/code] now in check_holiday_costings2.php this header is not sending final_room_description and room_group_numbetr as these are Array and i understood that i need to create session in check_holiday_costings.php so i can use this varibale here. [code] if($line[1]=="FLT") { $FLT_array[$FLT_count][flight_record_number]=$line[8]; $FLT_array[$FLT_count][departure_point]=$line[9]; $FLT_array[$FLT_count][departure_date]=$line[10]; $FLT_array[$FLT_count][departure_time]=$line[11]; $FLT_array[$FLT_count][destination_point]=$line[12]; $FLT_array[$FLT_count][arrive_dest_time]=$line[13]; $FLT_array[$FLT_count][flight_number]=$line[14]; $FLT_count++; [/code] after this code i tried to create an session for final_room_descriptiona and room_group_number but is not working. i am attaching a script so you can work it your self. In short in check_holiday_costings2.php NME header is not working. if you can help me a solve this error. I am junior programmer in PHP and only have little knowledge. If you can also suggest some tutorila or some good books. [a href=\"http://alloneweb.co.uk/PHPrp/check_holiday_costings.php\" target=\"_blank\"]http://alloneweb.co.uk/PHPrp/check_holiday_costings.php[/a] [a href=\"http://alloneweb.co.uk/PHPrp/check_holiday_costings2.php\" target=\"_blank\"]http://alloneweb.co.uk/PHPrp/check_holiday_costings2.php[/a] Thanks in advance.
-
[code] if($debug){ for($i=0;$i<sizeof($line);$i++){ echo ",line[$i]=".$line[$i]; } } if($line[1]=="HOL"){ $data_source=$line[5]; $tour_op=$line[6]; $depart_date=$line[7]; $depart_date_formatted=user_date_format($line[7]); $dep_airport=$line[8]; $dest_airport=$line[9]; $dep_time=$line[10]; $arr_time=$line[11]; $arr_uk_date=$line[12]; $arr_uk_point=$line[13]; $nights=$line[14]; $flight_type=$line[15]; $adult_price=$line[16]; $child_price=$line[17]; $child_max_age=$line[18]; $availability=$line[19]; $rating=$line[20]; $arr_dest_time=$line[21]; $dep_dest_time=$line[22]; $flight_no_out=$line[23]; $flight_no_ret=$line[24]; $travel_code=$line[25]; $resort_code=$line[26]; $resort_name=$line[27]; $hotel_name=$line[29]; $board_basis=$line[30]; $board_basis_text=$_SESSION["sess_board_basis_array"][$line[30]]; $holiday_code=$line[31]; $resort_features=$line[32]; $accom_features=$line[33]; $brochure_code=$line[34]; $brochure_page=$line[35]; $carrier_name=$line[36]; $product_name=$line[37]; } [/code] Can anyone help me to understand what this part of the code doing. I undestood that this is a parof the array. HELP..
-
[code] header="HDR BH2 01 000001 $ramesys_user $ramesys_pass $user_ref $reply_format $err_desc $status_msg $search_type "; $holiday_search=$header."JNY 0100 $start_rec $er $fnum_adults $fnum_child $fnum_infant $depart_date $search_fwithin $min_nights $search_max_nights $flight_type $dest $dep $dep2 $dep3 $mp $max_p $rating $tour_op $tour_op2 $tour_op3 $tour_op4 $dep_uk_time $arr_uk_time $arr_uk_date $arr_uk_point $arr_dest_time $dep_dest_time $flight_no_out $flight_no_ret $travel_code $top_insurance $insurance_co "; $holiday_search.="ACC $resort_code $resort_name $hotel_code $hotel_name $board_basis $resort_features $accom_features $holiday_code $transport_code "; if($child_max_age<=0){ $child_max_age=10; } if($debug){ view_array2($_SESSION["final_room_selection"],"session final_room_selection"); } $i=0; while (list($key, $value) = each ($_SESSION["final_room_selection"])) { $room_desc[$i]=$key; $i++; } //$room_group_number=1; //**************************************** NME Record **************************************************** $i=0; if($debug){ view_array2($pass_first_name,"pass_first_name"); } while (list($key, $value) = each ($pass_first_name)) { $room_group_number=$room_allocation[$key]; //$holiday_search.="NME ".$_SESSION["pass_title"][$i]." ".$_SESSION["pass_first_name"][$i]." ".$_SESSION["pass_surname"][$i]." ".$_SESSION["pass_day"][$i].$_SESSION["pass_month"][$i].$_SESSION["pass_year"][$i]." ".stripslashes($room_allocation[$i])." ".$room_group_number." $holiday_search.="NME ".$_SESSION["pass_title"][$key]." ".$_SESSION["pass_first_name"][$key]." ".$_SESSION["pass_surname"][$key]." ".$_SESSION["pass_day"][$key].$_SESSION["pass_month"][$key].$_SESSION["pass_year"][$key]." ".stripslashes($final_room_description[$room_allocation[$key]])." ".$room_group_number." "; $i++; } //**************************************** End NME Record ************************************************* //**************************************** ROM Record ***************************************************** // ROM record $room_allocation2=array(); reset($room_allocation); if($debug){ view_array2($_SESSION["room_selection"],"room_selection"); view_array2($_SESSION["room_description"],"room_description"); view_array2($_SESSION["final_room_description"],"final_room_description"); } reset($final_room_selection); while (list($key, $value) = each ($_SESSION["room_selection"])) { //echo "<br>key=".$key." value=".$value; //$room_no=$_SESSION["final_room_description"][$value]; if($value>0){ $holiday_search.="ROM ".$_SESSION["room_description"][$key]." ".$_SESSION["room_min_cost"][$key]." ".$_SESSION["room_max_cost"][$key]." ".$value." "; } } //**************************************** End ROM Record ************************************************* [/code] Below is a PHP script where i am trying to send information to MySQL database to get result from there. However, i am not doing this thing directley i am working with one protocol between them. but that does not make any diffrence as per my understanding. Now i want to send 2 other record. i do not understand that how do add them like this [code] $holiday_search=$header."JNY 0100 $start_rec $er $fnum_adults $fnum_child $fnum_infant $depart_date $search_fwithin $min_nights $search_max_nights $flight_type $dest $dep $dep2 $dep3 $mp $max_p $rating $tour_op $tour_op2 $tour_op3 $tour_op4 $dep_uk_time $arr_uk_time $arr_uk_date $arr_uk_point $arr_dest_time $dep_dest_time $flight_no_out $flight_no_ret $travel_code $top_insurance $insurance_co "; [/code] or this way. Also whats the diffrence. [code] $i=0; if($debug){ view_array2($pass_first_name,"pass_first_name"); } while (list($key, $value) = each ($pass_first_name)) { $room_group_number=$room_allocation[$key]; //$holiday_search.="NME ".$_SESSION["pass_title"][$i]." ".$_SESSION["pass_first_name"][$i]." ".$_SESSION["pass_surname"][$i]." ".$_SESSION["pass_day"][$i].$_SESSION["pass_month"][$i].$_SESSION["pass_year"][$i]." ".stripslashes($room_allocation[$i])." ".$room_group_number." $holiday_search.="NME ".$_SESSION["pass_title"][$key]." ".$_SESSION["pass_first_name"][$key]." ".$_SESSION["pass_surname"][$key]." ".$_SESSION["pass_day"][$key].$_SESSION["pass_month"][$key].$_SESSION["pass_year"][$key]." ".stripslashes($final_room_description[$room_allocation[$key]])." ".$room_group_number." "; $i++; } [/code] your help woud be really appriciated or if you know any other forum then guide me plz.
-
Hello friends, i am trying to achieve mailing list with PHP/MySQL. Please find code below. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] <?php function login($email, $password) // check username and password with db // if yes, return login type // else return false { // connect to db $conn = db_connect(); if (!$conn) return 0; $query = "select admin from subscribers where email='$email' and password = '$password'"; [b] $result = $conn->query($query);[/b] if (!$result) return false; if ($result->num_rows<1) return false; $row = $result->fetch_array(); if($row[0] == 1) return 'admin'; else return 'normal'; } function check_logged_in() { return ( check_normal_user() || check_admin_user() ); } function get_email() { if (isset($_SESSION['normal_user'])) return $_SESSION['normal_user']; if (isset($_SESSION['admin_user'])) return $_SESSION['admin_user']; return false; } function change_password($email, $old_password, $new_password, $new_password_conf) // change password for email/old_password to new_password // return true or false { // if the old password is right // change their password to new_password and return true // else return false if (login($email, $old_password)) { if($new_password==$new_password_conf) { if (!($conn = db_connect())) return false; $query = "update subscribers set password = sha1('$new_password') where email = '$email'"; $result = $conn->query($query); return $result; } else echo '<p> Your passwords do not match. </p>'; } else echo '<p> Your old password is incorrect. </p>'; return false; // old password was wrong } function check_normal_user() // see if somebody is logged in and notify them if not { if (isset($_SESSION['normal_user'])) return true; else return false; } function check_admin_user() // see if somebody is logged in and notify them if not { if (isset($_SESSION['admin_user'])) return true; else return false; } ?> [/quote] It is giving me error message for line in bold. Now i tried to use mysql_query=($query) but then its not allowing me to go inside the database. i am having similar kind of error with my other 2 programs and i really do not know what to do please advice.