Here is the query ...

select vd.vendor_id, vd.title, vd.tax, v.vtotal, vs.country_id, vs.zone_id, c.commission from oc_vendor_discount vd, oc_vendor v, oc_vendors vs, oc_commission where v.vproduct_id = '" . (int)$product['product_id'] . "' and vs.vendor_id = v.vendor and c.commission_id = vs.commission_id 

It gives a syntax error, but what I have no idea, that's right! Help me understand what a mistake!

Mistake ...

 Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT vd.vendor_id, vd.title, vd.tax, v.vtotal, vs.country_' at line 1 Error No: 1064 SELECT vd.vendor_id, vd.title, vd.tax, v.vtotal, vs.country_id, vs.zone_id, c.commission FROM oc_vendor_discount vd, oc_vendor v, oc_vendors vs, oc_commission WHERE v.vproduct_id = '47' AND vs.vendor_id = v.vendor AND c.commission_id = vs.commission_id in 
  • If it's not difficult, add an error message to the question. - cheops
  • Error: You have an error in your SQL syntax; checkout for the vid.vit.tax, vd.veitor_id, vd.tax, vc.vttal, vs.country_ at line 1 Error No: 1064 SELECT vd.vendor_id , vd.title, vd.tax, v.vtotal, vs.country_id, vs.zone_id, c.commission FROM oc_vendor_discount vd, oc_vendor v, oc_vendors vs, oc_commission WHERE v.vproduct_id = '47' AND vs.vendor_id = v. vendor AND c.commission_id = vs.commission_id in - privetsh
  • It feels like you have an invisible character before a SELECT, for example, a BOM from UTF-8. - cheops
  • How can this be fixed? I make this request in the very ppmayadmin and the same thing - privetsh
  • 2
    @privetsh, oc_commission oc_commission line to oc_commission c . - Visman

2 answers 2

 select vd.vendor_id, vd.title, vd.tax, v.vtotal, vs.country_id, vs.zone_id, c.commission from oc_vendor_discount vd, oc_vendor v, oc_vendors vs, oc_commission с <-было пропущено where v.vproduct_id = '" . (int)$product['product_id'] . "' and vs.vendor_id = v.vendor and c.commission_id = vs.commission_id 

    Quite simply, you are trying to make a SELECT with fields: vd.vendor_id, vd.title, vd.tax, v.vtotal, vs.country_id, vs.zone_id, c.commission . In this case, the WHERE condition is in your field that is not in the sample: v.vproduct_id, vs.vendor_id, v.vendor, c.commission_id, vs.commission_id .

    • Deal in another, request with error! - privetsh
    • o_O, and I'm talking about you. In the WHERE clause, there were fields that were not in the SELECT. This is a mistake. - Andrey Verbitskiy