Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6748335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:33:10+00:00 2026-05-26T12:33:10+00:00

I am trying to run a rather simple query, but it seems to return

  • 0

I am trying to run a rather simple query, but it seems to return absolutely no result;

$q  = "SELECT DISTINCT c.product_sku, c.compare_at, c.product_discount_id, d.amount FROM #__{vm}_product as c
LEFT OUTER JOIN #__vm_product_discount as d ON d.discount_id = c.product_discount_id WHERE";
$q .= "c.vendor_id='".$_SESSION['ps_vendor_id']."' ";
$q .= "AND #__{vm}_product.product_publish='Y' ";
$q .= "AND #__{vm}_product.isfront='1' ";
$q .= "AND c.isfront='1' ";

There are other queries after the above, but even when I comment out everything and use only one WHERE clause, nothing is returned. When I remove it, it works. All the below code did work until I added the JOIN.

I’m new to using joins, I’m guessing something about them makes the WHERE not work, but maybe I just messed up the code along the way, so perhaps better trained eyes could find an issue here?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:33:10+00:00Added an answer on May 26, 2026 at 12:33 pm

    In the above code, you do not have any space between the WHERE and the c.vendor_id. So your SQL would look like: blah blah WHEREc.vendor_id= blah blah. So the first thing to try would be to add a space after the WHERE in the first line.

    If there’s more to this problem than a missing space, please could you post an example of the actual SQL in $q that is being run, rather than the code used to produce it? Your code does not contain a liberal sprinkling of protective measures such as addslashes() or mysql_real_escape_string(), so it’s possible that there’s something nasty in there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to run a LINQ to SQL query that returns a result in
I am trying to run what I thought was a rather simple parameterized insert
I am trying to run the VS 2008 SP1 installer , but it says
I'm trying to get a simple uploading page up for images, but it gives
I am trying to learn the nuances of this simple function but am not
I am trying to run a simple shell command that runs and returns text
This seems like it should be a simple problem. I'm trying to host my
I am trying run a program from a qmake .pro file which modifies the
Situation: I'm trying run an https store (xcart) under one domain secure.example.com and I
Trying to run the following command in php to run powershell command... the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.