Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 27th, 2003, 01:53 PM
Authorized User
 
Join Date: Sep 2003
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jams30
Default I'm sure there's a simple answer to this!

Hi

Firstly, please excuse my lack of understanding on PHP and MySql as I am but a struggling newbie with all of this!!

I have created a simple MySql database and am trying to retrieve records from it based on a query. I have built a form with two list boxes, 'From' and 'To' - when selecting an option from both lists and submitting the form, the information is getting passed to the next page where I can associate variables $From_Price and $To_Price respectively. As you can see, I have tested these variables in the first echo statement, but when trying to use them as part of a query statement I get nothing appearing on the page as results apart from the "Your selection of properties are..."

<?php
include "./common_db2.inc";

echo "<center>Your selection of properties are from $From_Price to $To_Price</center><br><br>";
$link_id = db_connect();
$result = mysql_query("select * from prices WHERE price >= '$From_Price' and price <= '$To_Price' order by price", $link_id);

while($query_data = mysql_fetch_row($result)) {
echo "Property no: ",$query_data[0]," is priced at £",$query_data[1]," and the description on this is ",$query_data[2],"<P>";
}

?>

Whilst this query works fine with static values I want to the use to be able to choose the parameters that the query is based on.

Can someone please advise me on where I may be going wrong, as the title suggests, I'm sure there's a simple answer to this!!


Many thanks

Jamal






Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple - Quick Answer hopefully! IainAL VB How-To 4 April 18th, 2007 07:53 AM
Try this, answer me surendran PHP How-To 1 November 14th, 2006 07:09 AM
Please answer canasdaq XML 3 April 19th, 2006 09:04 AM
This has to be a simple question to answer. Bill_Thompson Beginning VB 6 1 March 7th, 2006 01:04 PM
answer IvAnR C++ Programming 1 July 22nd, 2005 08:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.