...

View Full Version : Quering POSTED Data problem (MySQL Prob)!!!



zain1992
07-17-2007, 06:29 AM
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
$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:


while($row = mysql_fetch_array($result))

so if some one can tell me what i am doing wrong that will help me alot.

zain1992
07-17-2007, 06:44 AM
i also tried putting in the $_POST['rbc'] in the $rbc variables place but still no results.

CFMaBiSmAd
07-17-2007, 07:12 AM
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.

zain1992
07-17-2007, 07:42 AM
i am sorry can you explain i red it but still nothing.

zain1992
07-17-2007, 07:55 AM
can anyone please help me.

zain1992
07-17-2007, 05:21 PM
anyone willing to help please?

rafiki
07-17-2007, 05:24 PM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum