- Posts: 2
COMMUNITY FORUM
[SOLVED] k2 module
- Evanggelos
-
Topic Author
- Offline
- New Member
Less
More
10 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
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
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Moderator
Less
More
- Posts: 8743
10 years 6 months ago #133159
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
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
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 2
10 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.
- Lefteris
-
- Offline
- Moderator
Less
More
- Posts: 8743
10 years 6 months ago #133161
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
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.