Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jul 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Quering POSTED Data problem (MySQL Prob)!!!

    Hello my name is Zain,

    well i basically made a code that pulls up info for when the user inputs it through the post method. here is the code:

    PHP Code:
    <?php
    $citypr 
    $_POST["cityp"] . "rules";
    $rbc $_POST["rbc"];

    // Base Table and Headings

    echo '<table border="1">';

    // Resulting and integrating into Table


    $con mysql_connect("localhost","MY_USER(Confidential)","MY_PASS(Confidential");
    if (!
    $con)
      {
      die(
    'Could not connect: ' mysql_error());
      }

    mysql_select_db("qfq"$con);



    $result mysql_query("SELECT * FROM $citypr WHERE RuleBaseCode=$rbc");
    while(
    $row mysql_fetch_array($result))
      {
      echo 
    "<tr><td>Accompanied CHD or INF</td><td>" $row['AccompaniedCHDINF'] . "</td></tr>" "<tr><td>Addons Rules</td><td>" $row['AddonsRule'] . "</td></tr>" "<tr><td>Blackout Dates</td><td>" $row['BlackoutDates'] . "</td></tr>" "<tr><td>Booking Classes</td><td>" $row['BookingClasses'] . "</td></tr>" "<tr><td>Cancellation Penalty</td><td>" $row['CancPenalty'] . "</td></tr>" "<tr><td>Class Combination</td><td>" $row['ClassComb'] . "</td></tr>" "<tr><td>Credit Card Acceptance</td><td>" $row['CCAccept'] . "</td></tr>" "<tr><td>Credit Card Note</td><td>" $row['CCNote'] . "</td></tr>" "<tr><td>Days of travel</td><td>" $row['DaysOfTrvl'] . "</td></tr>" "<tr><td>Discount CHD</td><td>" $row['DiscountCHD'] . "</td></tr>" "<tr><td>Discount INF</td><td>" $row['DiscountINF'] . "</td></tr>" "<tr><td>Discount SENIOR</td><td>" $row['DiscountSEN'] . "</td></tr>" "<tr><td>Discount YOUTH</td><td>" $row['DiscountYOUTH'] . "</td></tr>" "<tr><td>eTicket</td><td>" $row['eTicket'] . "</td></tr>" ."<tr><td>Flight Restrictions</td><td>" $row['FlightRes'] . "</td></tr>" "<tr><td>Max Stay</td><td>" $row['MaxStay'] . "</td></tr>" ."<tr><td>Min Stay</td><td>" $row['MinStay'] . "</td></tr>" "<tr><td>Name Change</td><td>" $row['NameCHG'] . "</td></tr>" "<tr><td>Note 1</td><td>" $row['Note1'] . "</td></tr>" "<tr><td>Note 2</td><td>" $row['Note2'] . "</td></tr>" ."<tR><td>Note 3</td><td>" $row['Note3'] . "</td></tr>" "<tr><td>Note 4</td><td>" $row['Note4'] . "</td></tr>" ."<tr><td>Note 5</td><td>" $row['Note5'] . "</td></tr>" "<tr><td>Note 6</td><td>" $row['Note6'] . "</td></tr>" ."<tr><td>One way</td><td>" $row['Oneway'] . "</td></tr>" "<tr><Td>Open Jaw</td><td>" $row['OpenJaw'] . "</td></tr>" "<tr><td>Open Return</td><td>" $row['OpenRET'] . "</td></tr>" "<tr><td>OSI Note</td><td>" $row['OSINote'] . "</td></tr>" ."<tr><td>Overnight Expense</td><td>" $row['OvernEXP'] . "</td></tr>" "<tr><td>PTA</td><td>" $row['PTA'] . "</td></tr>" ."<tr><td>Q Surcharges</td><td>" $row['QSurcharge'] . "</td></tr>" "<tr><td>Rerouting</td><td>" $row['Rerouting'] . "</td></tr>" "<tr><td>Reservation Changes</td><td>" $row['ReservationCHG'] . "</td></tr>" "<tr><td>Selling Dates</td><td>" $row['SellDates'] . "</td></tr>" "<tr><td>Stopover charges</td><td>" $row['StopoverCHRG'] . "</td></tr>" "<tr><td>Stopover Oneway</td><td>" $row['Stopover1way'] . "</td></tr>" "<tR><td>Surcharges</td><td>" $row['Surcharges'] . "</td></tr>" "<tr><td>Ticketing Dates</td><td>" $row['TicketingDates'] . "</td></tr>" "<tR><td>Ticketing Offices</td><td>" $row['TicketingOffices'] . "</td></tr>" "<tr><td>Travel Completion Date<td>" $row['TrvlCompDate'] . "</td></tr>" "<tr><td>Upsell</td><td>" $row['Upsell'] . "</td></tr>" "<tr><td>Validity Extension</td><td>" $row['ValidityExt'] . "</td></tr>" "<tr><td>Via Points</td><td>" $row['ViaPoints'] . "</td></tr>" "<tr><td>WeekendDays</td><td>" $row['WeekendDays'] . "</td></tr>" "<tr><td>routing</td><td>" $row['Routing'] ."</td></tr>";
      echo 
    "<br />";
    }

    ?>

    now when ever i run it it gives me this error:
    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\http\PROJECT\BackEnd\rules.php on line 23
    line 23 is this peice of code:

    PHP Code:
    while($row mysql_fetch_array($result)) 
    so if some one can tell me what i am doing wrong that will help me alot.

  • #2
    New Coder
    Join Date
    Jul 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i also tried putting in the $_POST['rbc'] in the $rbc variables place but still no results.

  • #3
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    2,958
    Thanks
    2
    Thanked 304 Times in 296 Posts
    Please see the error checking and error reporting logic in the mysql_query(...) examples in the PHP manual at this link - http://php.net/mysql_query to get PHP/mysql to tell you why your query is failing.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #4
    New Coder
    Join Date
    Jul 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i am sorry can you explain i red it but still nothing.

  • #5
    New Coder
    Join Date
    Jul 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    can anyone please help me.

  • #6
    New Coder
    Join Date
    Jul 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    anyone willing to help please?

  • #7
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,039
    Thanks
    19
    Thanked 42 Times in 42 Posts
    wow you should wait inbetween bumps, specially how its in the rules
    use mysql_query($sql) or die(mysql_error());
    set error reporting to all


  •  

    Posting Permissions

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