hi there!
I have this method of writing my queries,
First:
$path = MODX_CORE_PATH . 'components/mod1/';
$result = $modx->addPackage('mod1',$path . 'model/','mod_');
$output = null;
$urlresult = "A";
/*for the A-Z drug search*/
if(isset($_GET['alpha'])){
if ((strlen($_GET['alpha'])!=null)||($_GET['alpha'])!=0){
$urlresult = $_GET['alpha'];
}
}
$query = $modx->newQuery('Tblbook');
$query->select(array (
'Tblbook.brand_name',
'Tblbook.system_product_id',
'Tblbook.system_brand_id',
'TBOOKS.content',
'TBOOKS.description',
'TBOOKS.long_indication'
));
$query->innerJoin('Tblbooks', 'TBOOKS', array(" Tblbook.system_brand_id = TBOOKS.system_brands_id"));
$query->where(array("Tblbook.brand_name:LIKE" => "$urlresult%"));
$query->groupby('brand_name');
$products = $modx->getCollection('Tblbook',$query);
Second:
$search = $modx->query("SELECT b.form_class, a.system_brand_id, a.system_product_id, b.company, a.system_edition_id, a.brand_name, b.content, c.section1_id, c.section2_id, c.section3_id, c.section4_id,
MATCH (tfv_records)AGAINST ('$xkeywordx' IN BOOLEAN MODE) AS relevance
FROM mod_tfvrecords a, mod_tblcontents b, mod_tblproductcategory c
WHERE MATCH (tfv_records)AGAINST ('$xkeywordx' IN BOOLEAN MODE)
AND a.system_brand_id = b.system_brands_id
AND a.system_product_id = c.system_product_id GROUP BY a.system_product_id HAVING relevance > 0.1 ORDER BY relevance DESC LIMIT 50");
now my question is , what method is more optimize? what method is more convenient to use in modx?I having a hard time choosing with this method.
can you give some advice? Im new in modx so I'm eager to learn new things in modx way smiley
I hope you understand my problem!
thanks!