Keyword

[SOLVED] k2 module

  • Evanggelos
  • Evanggelos's Avatar Topic Author
  • Offline
  • New Member
More
9 years 6 months ago #133158 by Evanggelos
[SOLVED] k2 module was created by Evanggelos
hi i want to create module for k2 .
i want your help.
when i select from module id 1 from item to show title and fulltext from db.
i want to select multi id from admin e.g Select id : 1, 2

query is this $db = JFactory::getDbo();
$query = 'SELECT * FROM #__k2_items WHERE id ='.$params->get('id');
$db->setQuery($query);
$result = $db->LoadObjectList();
return $result;


loop is this : <div class="nameclas" style="width:200px;">
<?php foreach ($result as $row) :?>
<h1><?php echo $row->title; ?> </h1>
<?php endforeach ; ?>
</div> :(


if i select id 1 from backend My returns the title one..
if i select id 1, 2 from backend i have this 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 '2' at line 1 SQL=SELECT * FROM d1l9y_k2_items WHERE id =1,2..... please help me... sorry for my english sucks :D

​Best regards,
Evanggelos E. Goritsas
Attachments:

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #133159 by Lefteris
Replied by Lefteris on topic Re: k2 module
Hi. Probably you need to read some SQL tutorials to learn how you can query with multiple keys. In general the IN function can be used dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#function_in . You can always take a look at the code of mod_k2_content to get examples and ideas.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Evanggelos
  • Evanggelos's Avatar Topic Author
  • Offline
  • New Member
More
9 years 6 months ago #133160 by Evanggelos
Replied by Evanggelos on topic Re: k2 module
ty now is ok my module ty a lot!!

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #133161 by Lefteris
Replied by Lefteris on topic Re: k2 module
You are welcome.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum