Uni Student doing re-sits, needs help BIGTIME - Getting Data

I have to be able to retreive the data from my Database so that the customers are sorted into two seperate fields of ?40 and ?60.

PHP CODING

[php]

View Customers by category <?php #get the Customer Price Category i.e. Acat variable $Cat = $_GET['Acat']; #-------------------------------------------------------- echo(""); echo("

Customer Price Category Results for :$CAT


"); $VariableName = $_GET['VariablePassed']; #-------------------------------------------------------- # connect to MySQL $conn = @mysql_connect("localhost","ajdref","ref2") or die ("sorry - could not wont connect to MySQL"); # select the specified database $rs = @mysql_select_db("ajdref", $conn) or die ("sorry - could not connect to the ajdref"); #create the query - sets $sql to contain the required query $sql = 'SELECT * FROM `Booking Database` ORDER BY `Booking Database` . `Price Cat` ASC LIMIT 0, 30 '; #execute the query - uses the mysql_query() function to issue the $sql query to the $conn connection #$rs contains the result set in the form of an array $rs = mysql_query($sql,$conn); ?> [/php]

HTML CODING

[code]

Search by category
Search by Price Category

Please choose price category from this list. A - ?40 B - ?60

Now click 'Send'.
[/code][/b]

**Mod Edit - Added PHP Tags for better readability.

u just need to use a where statement:
[php]#create the query - sets $sql to contain the required query
$sql = ‘SELECT * FROM Booking Database WHERE Booking Database . Price Cat = "’. mysql_escape_sting($Cat) .’" ORDER BY Booking Database . Price Cat ASC LIMIT 0, 30 ';[/php]

by the way:

#$rs contains the result set in the form of an array
this is wrong. $rs contains a result id to be used like: while($row=mysql_fetch_assoc($rs)) ...
Sponsor our Newsletter | Privacy Policy | Terms of Service