SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    146
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problem with mysql search

    Hi
    I want to do a search. The problem is the search only process till d.discounted_fare_id = '$dis_fare_id1' (before 'if...else'). Does anyone know what's the problem of my code?? Thanks!

    Code:
    $sql8 = "SELECT * FROM validflightno v, adw_temp a, discounted_temp d ";
    $sql8 .= "WHERE wunique_no = '$adwno' AND v.discounted_fare_id = '$dis_fare_id1' AND d.discounted_fare_id = '$dis_fare_id1' ";

    if ($flight_validity_flag=='t' && $flight_invalidity_flag=='t'){
    $sql8 .= "AND (($legs_valid_flight_restriction LIKE '%.$counter1.%' AND (fli_num+0) = `$valid_flight_no`)";
    }

    elseif ($flight_validity_flag=='t' && $flight_invalidity_flag=='f') {
    $sql8 .= "AND $legs_valid_flight_restriction LIKE '%.$counter1.%' AND (fli_num+0) = `$valid_flight_no`";
    }

    else{
    $sql8 .= "";
    }

    $result8 = $db->exec($sql8);

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    2 tips to help you debug code.

    turn up error reporting. php will now tell you if you try to use an undefined variable.
    PHP Code:
    error_reporting(E_ALL);
    ini_set('display_errors'1); 
    if a condition is not being met, then you should examine the condition.
    PHP Code:
    var_dump($flight_validity_flag);
    var_dump($flight_invalidity_flag);
    if (
    $flight_validity_flag=='t' && $flight_invalidity_flag=='t'){ 


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •