Jump to content

Mixing Different Queries Together


justlukeyou

Recommended Posts

I have two seperate piece of code.  One which sorts description and one which sorts price.  However, I am looking to almalgamate them into one.  I have tried the following however I appear to be way off. 

 

I want to select a product description with one link and then select a price range.  However, I want the price range to read the description. 

 

<?phpif( isset($_GET['description' ; 'price' ]))
$description = $_GET['description' ; 'price'];
$query = "SELECT * FROM productfeed WHERE description like '%$description%' LIMIT 0, 10";
$query = "SELECT * FROM productfeed WHERE price like '%$price%' LIMIT 0, 10";
$fetchdata = mysql_query($query) or die("query: $query<br>
This has an error: " . mysql_error() . '<br>');while($row = mysql_fetch_array($fetchdata)) {
$id = $row['id'];
$image = $row['awImage'];
$link = $row['link'];
$description = $row['description'];
$fulldescription = $row['fulldescription'];
$price = $row['price'];

 

<?phpif( isset($_GET['description']))
$description = $_GET['description'];
$query = "SELECT * FROM productfeed WHERE description like '%$description%' LIMIT 0, 10";
$fetchdata = mysql_query($query) or die("query: $query<br>
This has an error: " . mysql_error() . '<br>');while($row = mysql_fetch_array($fetchdata)) {
$id = $row['id'];
$image = $row['awImage'];
$link = $row['link'];
$description = $row['description'];
$fulldescription = $row['fulldescription'];
$price = $row['price'];

 

<?phpif( isset($_GET['price']))
$price = $_GET['price'];
$query = "SELECT * FROM productfeed WHERE price like '%$price%' LIMIT 0, 10";
$fetchdata = mysql_query($query) or die("query: $query<br>
This has an error: " . mysql_error() . '<br>');while($row = mysql_fetch_array($fetchdata)) {
$id = $row['id'];
$image = $row['awImage'];
$link = $row['link'];
$description = $row['description'];
$fulldescription = $row['fulldescription'];
$price = $row['price'];

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.